ConnectResponseHandler interface
The handler to set connect event response
Methods
fail(400 | 401 | 500, string) | Return failed response and the service will reject the client WebSocket connection. |
set |
Set the state of the connection |
success(Connect |
Return success response to the service. |
Method Details
fail(400 | 401 | 500, string)
Return failed response and the service will reject the client WebSocket connection.
function fail(code: 400 | 401 | 500, detail?: string)
Parameters
- code
-
400 | 401 | 500
Code can be 400 user error, 401 unauthorized and 500 server error.
- detail
-
string
The detail of the error.
setState(string, unknown)
Set the state of the connection
function setState(name: string, value: unknown)
Parameters
- name
-
string
The name of the state
- value
-
unknown
The value of the state
success(ConnectResponse)
Return success response to the service.
function success(response?: ConnectResponse)
Parameters
- response
- ConnectResponse
The response for the connect event.