Skip to content

Need way to distinguish server disconnects from client disconnects #878

Open
@thully

Description

@thully

I'm using the socket.io library in my iOS app, and want to always maintain a connection as long as the app is active, automatically reconnecting after every disconnect . I can do this adding a disconnect handler that reconnects like the following:

socket.on(clientEvent: .disconnect) { args, ack in
self.socket.connect()
}

While this works, it seems that the handler is called for both disconnects due to external causes and disconnects initiated manually (i.e. by calling socket.disconnect()). While you can set flags/remove listeners every time one explicitly calls disconnect, It would be nice to have an easier way of distinguishing these built into the API.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions