Constructs a new SocketClient.
Socket.io Socket instance for internal use.
Contains implementations for the events described by the API. This guarantees compatibility with any SocketServer that implements the same API.
Reference to the socket.io-client library. If the client is running in the browser, it is assumed that io
will
be available on window
.
Sets up the socket handlers for the client.
Gives the ability to block and wait for an event. Usage: await this.blockEvent('some-event');
Attempts to connect to a SocketServer.
Disconnects from the SocketServer, if there was a connection.
Emits an event to the connected SocketServer. TypeScript ensures that the event adheres to the API description.
Returns the socket id if the client is connected.
Processes an incoming event with the appropriate socketHandler. If the handler returns an EventResponse, the proper event will automatically be emitted.
Returns whether or not the client has an active socket connection.
Handles a Response that requires a reply.
Generated using TypeDoc
Basic socket client that can be used in Node or in the browser.