0

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.

Carlos Frank
  • 167
  • 2
  • 13

1 Answers1

0

You need to to specify a connection.

var primus = Primus.connect('ws://localhost:8000');
Saran
  • 713
  • 6
  • 14