| 84 | * }); |
| 85 | */ |
| 86 | export class Socket< |
| 87 | ListenEvents extends EventsMap = DefaultEventsMap, |
| 88 | EmitEvents extends EventsMap = ListenEvents, |
| 89 | ServerSideEvents extends EventsMap = DefaultEventsMap, |
| 90 | SocketData = any, |
| 91 | > extends StrictEventEmitter< |
| 92 | ListenEvents, |
| 93 | EmitEvents, |
| 94 | SocketReservedEventsMap |
| 95 | > { |
| 96 | /** |
| 97 | * An unique identifier for the session. |
| 98 | */ |
| 99 | public readonly id: SocketId; |
| 100 | /** |
| 101 | * Whether the connection state was recovered after a temporary disconnection. In that case, any missed packets will |
| 102 | * be transmitted to the client, the data attribute and the rooms will be restored. |
| 103 | */ |
| 104 | public readonly recovered: boolean = false; |
| 105 | /** |
| 106 | * The handshake details. |
| 107 | */ |
| 108 | public readonly handshake: Handshake; |
| 109 | /** |
| 110 | * Additional information that can be attached to the Socket instance and which will be used in the |
| 111 | * {@link Server.fetchSockets()} method. |
| 112 | */ |
| 113 | public data: SocketData = {} as SocketData; |
| 114 | /** |
| 115 | * Whether the socket is currently connected or not. |
| 116 | * |
| 117 | * @example |
| 118 | * io.use((socket, next) => { |
| 119 | * console.log(socket.connected); // false |
| 120 | * next(); |
| 121 | * }); |
| 122 | * |
| 123 | * io.on("connection", (socket) => { |
| 124 | * console.log(socket.connected); // true |
| 125 | * }); |
| 126 | */ |
| 127 | public connected: boolean = false; |
| 128 | |
| 129 | /** |
| 130 | * The session ID, which must not be shared (unlike {@link id}). |
| 131 | * |
| 132 | * @private |
| 133 | */ |
| 134 | private readonly pid: PrivateSessionId; |
| 135 | |
| 136 | // TODO: remove this unused reference |
| 137 | private readonly server: Server< |
| 138 | ListenEvents, |
| 139 | EmitEvents, |
| 140 | ServerSideEvents, |
| 141 | SocketData |
| 142 | >; |
| 143 | private readonly adapter: Adapter; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…