質問

will my server be notified about disconnect on the client side? I assume the answer is yes if the disconnect happens explictly like below.

pusher.disconnect()

however what happens if the user simply closes the browser?

Another thing is there a way to notify the server that a certain channel has not been in use by the client(s) for some while?

役に立ちましたか?

解決

The connection states documentation shows how to bind to connection state changes.

however what happens if the user simply closes the browser?

This really depends on if the browser calls webSocketInstance.onclose so the Pusher JavaScript library is informed before the browser is closed. You could always detect this yourself using window.onbeforeunload, window.onunload or the addEventListener versions.

Another thing is there a way to notify the server that a certain channel has not been in use by the client(s) for some while?

You can use WebHooks so that when a channel becomes vacated your app server will be informed.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top