0

Using Pubnub's Socket.io implementation, how does one disconnect from a channel (or at all)?

I set up my connection like this:

socket = io.connect "http://pubsub.pubnub.com",
  channel:       "some-channel"
  publish_key:   "..."
  subscribe_key: "..."

But when I try to disconnect like this (the way you do when using normal Socket.io):

socket.disconnect()

I get error messages like this:

Uncaught TypeError: Cannot read property 'channel' of undefined
nicholaides
  • 19,211
  • 12
  • 66
  • 82

2 Answers2

0

This is a bug in Pubnub's Socket.io implementation. See the issue on Github. It has been fixed in version 3.4.

nicholaides
  • 19,211
  • 12
  • 66
  • 82
0

I think correct syntax is :

socket.on( 'disconnect', function() {
    console.log('my connection dropped');
} );

https://github.com/pubnub/pubnub-api/tree/master/socket.io

fdior
  • 1
  • 2