BrainBoxLabs / brain-socket-js

JS helper class for event-driven Websockets with Brainsocket & Laravel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing without any errors.

Arduinology opened this issue · comments

I have a fresh Laravel installation, the only thing I have done is added BrainSocket as detailed in the documentation and enabled restful controllers and set a route to the HomeController. The "You have arrived" view is returning as intended, the BrainSocket.js is loading without errors, and the BrainSocket object seems to load with no errors in the web console, brainsocket server, or php logs. When the following code is added to my hello.php view I can no longer get console.log()'s to show in the web browser of the client.

<script type="text/javascript" src="js/brain-socket.min.js" />
<script type="text/javascript">

    window.app = {};

    app.BrainSocket = new BrainSocket(
            new WebSocket('ws://localhost:8080'),
            new BrainSocketPubSub()
    );
    app.BrainSocket.Event.listen('some.event',function(msg)
    {
        console.log(msg);
    });

    app.BrainSocket.Event.listen('app.success',function(msg)
    {
        console.log(msg);
    });

    app.BrainSocket.Event.listen('app.error',function(msg)
    {
        console.log(msg);
    });
    console.log("test");
</script>

What do you suggest I do?

System Specs
CentOS 6.5
PHP 5.5.12
Apache 2.2.15
Laravel 4

Nevermind, just had to use Blade syntax to include the JavaScript reference.