Skip to main content
Version: 3.x.x

Socket Client


Introduction

Adapter is a class that gives us possibility to interact with servers. The default adapter is used to communicate with the Websocket or SSE server. However, there is nothing to prevent you from changing this and creating the adapter you need. Thanks to event communication, you can set your own adapter as you wish by only fulfilling the typescript requirements. This way you can create your own adapters for existing libraries like socket.io.

Preview

new SocketAdapter<SocketType>(socket) {
socket:SocketType
reconnectionAttempts:number
pongTimer:Timeout
pingTimer:Timeout
open:boolean
logger:LoggerType
listeners:Map<string, Set<ListenerCallbackType<any>>>
forceClosed:boolean
connecting:boolean
adapter:WebSocket | EventSource
init:void
clearTimers:void
connect:void
disconnect:void
emit:void
heartbeat:void
listen:void
reconnect:void
removeListener:void
sendEventMessage:void
}