Carlos Frank
Carlos Frank

Reputation: 167

Primus-websocket client side

Im trying to make a client side for websocket using Primus framework.

here my client side code

    <script src="primus/primus.js"></script>
<script>
    // connect to current URL
    var primus = Primus.connect()

    primus.on("open", function () {
        console.log("Connected!")
    })

    primus.on("data", function (data) {
        console.log("data =", data)
    })
</script>

the error is that Primus.connect is not a function

Thank you.

Upvotes: 0

Views: 741

Answers (1)

Saran
Saran

Reputation: 713

You need to to specify a connection.

var primus = Primus.connect('ws://localhost:8000');

Upvotes: 0

Related Questions