Orderly SDKs / Modules / @orderly.network/net / WS
• new WS(options
)
Name | Type |
---|---|
options | WSOptions |
• Private
_eventContainer: Map
<string
, Set
<Function
>>
• Private
_eventHandlers: Map
<string
, Topics
>
• Private
_eventPrivateHandlers: Map
<string
, Topics
>
• Private
_pendingPrivateSubscribe: any
[][] = []
• Private
_pendingPublicSubscribe: any
[][] = []
• Private
Optional
_privateHeartbeatTime: number
• Private
_privateRetryCount: number
= 0
• Private
Optional
_publicHeartbeatTime: number
• Private
_publicRetryCount: number
= 0
• Private
_publicSocket: WebSocket
• Private
authenticated: boolean
= false
• Private
options: WSOptions
• Private
privateIsReconnecting: boolean
= false
• Private
Optional
privateSocket: WebSocket
• Private
publicIsReconnecting: boolean
= false
• Private
reconnectInterval: number
= 1000
• set
accountId(accountId
): void
Name | Type |
---|---|
accountId | string |
void
• get
client(): Object
Object
Name | Type |
---|---|
private? | WebSocket |
public | WebSocket |
▸ Private
authenticate(accountId
): Promise
<void
>
Name | Type |
---|---|
accountId | string |
Promise
<void
>
▸ Private
bindEvents(): void
void
▸ Private
checkSocketStatus(): void
Determine the current connection status,
void
▸ close(): void
void
▸ closePrivate(code?
, reason?
): void
Name | Type |
---|---|
code? | number |
reason? | string |
void
▸ Private
createPrivateSC(options
): void
Name | Type |
---|---|
options | WSOptions |
void
▸ Private
createPublicSC(options
): void
Name | Type |
---|---|
options | WSOptions |
void
▸ emit(eventName
, message
): void
Name | Type |
---|---|
eventName | string |
message | any |
void
▸ Private
errorBoardscast(error
, eventHandlers
): void
Name | Type |
---|---|
error | any |
eventHandlers | Map <string , Topics > |
void
▸ Private
generateMessage(params
, onUnsubscribe?
, onMessage?
): [MessageParams
, (event
: string
) => any
]
Name | Type |
---|---|
params | any |
onUnsubscribe? | (event : string ) => any |
onMessage? | (message : any ) => any |
[MessageParams
, (event
: string
) => any
]
▸ Private
getTopicKeyFromMessage(message
): string
Name | Type |
---|---|
message | any |
string
▸ Private
getTopicKeyFromParams(params
): string
Name | Type |
---|---|
params | any |
string
▸ Private
handlePendingPrivateTopic(): void
void
▸ off(eventName
, callback
): void
Name | Type |
---|---|
eventName | string |
callback | (message : any ) => any |
void
▸ on(eventName
, callback
): void
Name | Type |
---|---|
eventName | string |
callback | (message : any ) => any |
void
▸ Private
onMessage(event
, socket
, handlerMap
): void
Name | Type |
---|---|
event | MessageEvent <any > |
socket | WebSocket |
handlerMap | Map <string , Topics > |
void
▸ Private
onNetworkStatusChange(): void
void
▸ Private
onOpen(event
): void
Name | Type |
---|---|
event | Event |
void
▸ Private
onPrivateClose(event
): void
Name | Type |
---|---|
event | CloseEvent |
void
▸ Private
onPrivateError(event
): void
Name | Type |
---|---|
event | Event |
void
▸ Private
onPrivateMessage(event
): void
Name | Type |
---|---|
event | MessageEvent <any > |
void
▸ Private
onPrivateOpen(event
): void
Name | Type |
---|---|
event | Event |
void
▸ Private
onPublicClose(event
): void
Name | Type |
---|---|
event | CloseEvent |
void
▸ Private
onPublicError(event
): void
Name | Type |
---|---|
event | Event |
void
▸ Private
onPublicMessage(event
): void
Name | Type |
---|---|
event | MessageEvent <any > |
void
▸ Private
onVisibilityChange(): void
void
▸ onceSubscribe(params
, callback
): void
Name | Type |
---|---|
params | any |
callback | Omit <WSMessageHandler , "onUnsubscribe" > |
void
▸ openPrivate(accountId
): void
Name | Type |
---|---|
accountId | string |
void
▸ privateSubscribe(params
, callback
): () => void
Name | Type |
---|---|
params | any |
callback | WSMessageHandler | Omit <WSMessageHandler , "onUnsubscribe" > |
fn
▸ (): void
void
▸ Private
reconnectPrivate(): void
void
▸ Private
reconnectPublic(): void
void
▸ send(message
): void
Name | Type |
---|---|
message | any |
void
▸ subscribe(params
, callback
, once?
, id?
): undefined
| unsubscribe
Name | Type |
---|---|
params | any |
callback | WSMessageHandler | Omit <WSMessageHandler , "onUnsubscribe" > |
once? | boolean |
id? | string |
undefined
| unsubscribe
▸ Private
unsubscribe(parmas
, webSocket
, handlerMap
): void
Name | Type |
---|---|
parmas | MessageParams |
webSocket | WebSocket |
handlerMap | Map <string , Topics > |
void
▸ Private
unsubscribePrivate(parmas
): void
Name | Type |
---|---|
parmas | MessageParams |
void
▸ Private
unsubscribePublic(parmas
): void
Name | Type |
---|---|
parmas | MessageParams |
void
Orderly SDKs / Modules / @orderly.network/net / WS
• new WS(options
)
Name | Type |
---|---|
options | WSOptions |
• Private
_eventContainer: Map
<string
, Set
<Function
>>
• Private
_eventHandlers: Map
<string
, Topics
>
• Private
_eventPrivateHandlers: Map
<string
, Topics
>
• Private
_pendingPrivateSubscribe: any
[][] = []
• Private
_pendingPublicSubscribe: any
[][] = []
• Private
Optional
_privateHeartbeatTime: number
• Private
_privateRetryCount: number
= 0
• Private
Optional
_publicHeartbeatTime: number
• Private
_publicRetryCount: number
= 0
• Private
_publicSocket: WebSocket
• Private
authenticated: boolean
= false
• Private
options: WSOptions
• Private
privateIsReconnecting: boolean
= false
• Private
Optional
privateSocket: WebSocket
• Private
publicIsReconnecting: boolean
= false
• Private
reconnectInterval: number
= 1000
• set
accountId(accountId
): void
Name | Type |
---|---|
accountId | string |
void
• get
client(): Object
Object
Name | Type |
---|---|
private? | WebSocket |
public | WebSocket |
▸ Private
authenticate(accountId
): Promise
<void
>
Name | Type |
---|---|
accountId | string |
Promise
<void
>
▸ Private
bindEvents(): void
void
▸ Private
checkSocketStatus(): void
Determine the current connection status,
void
▸ close(): void
void
▸ closePrivate(code?
, reason?
): void
Name | Type |
---|---|
code? | number |
reason? | string |
void
▸ Private
createPrivateSC(options
): void
Name | Type |
---|---|
options | WSOptions |
void
▸ Private
createPublicSC(options
): void
Name | Type |
---|---|
options | WSOptions |
void
▸ emit(eventName
, message
): void
Name | Type |
---|---|
eventName | string |
message | any |
void
▸ Private
errorBoardscast(error
, eventHandlers
): void
Name | Type |
---|---|
error | any |
eventHandlers | Map <string , Topics > |
void
▸ Private
generateMessage(params
, onUnsubscribe?
, onMessage?
): [MessageParams
, (event
: string
) => any
]
Name | Type |
---|---|
params | any |
onUnsubscribe? | (event : string ) => any |
onMessage? | (message : any ) => any |
[MessageParams
, (event
: string
) => any
]
▸ Private
getTopicKeyFromMessage(message
): string
Name | Type |
---|---|
message | any |
string
▸ Private
getTopicKeyFromParams(params
): string
Name | Type |
---|---|
params | any |
string
▸ Private
handlePendingPrivateTopic(): void
void
▸ off(eventName
, callback
): void
Name | Type |
---|---|
eventName | string |
callback | (message : any ) => any |
void
▸ on(eventName
, callback
): void
Name | Type |
---|---|
eventName | string |
callback | (message : any ) => any |
void
▸ Private
onMessage(event
, socket
, handlerMap
): void
Name | Type |
---|---|
event | MessageEvent <any > |
socket | WebSocket |
handlerMap | Map <string , Topics > |
void
▸ Private
onNetworkStatusChange(): void
void
▸ Private
onOpen(event
): void
Name | Type |
---|---|
event | Event |
void
▸ Private
onPrivateClose(event
): void
Name | Type |
---|---|
event | CloseEvent |
void
▸ Private
onPrivateError(event
): void
Name | Type |
---|---|
event | Event |
void
▸ Private
onPrivateMessage(event
): void
Name | Type |
---|---|
event | MessageEvent <any > |
void
▸ Private
onPrivateOpen(event
): void
Name | Type |
---|---|
event | Event |
void
▸ Private
onPublicClose(event
): void
Name | Type |
---|---|
event | CloseEvent |
void
▸ Private
onPublicError(event
): void
Name | Type |
---|---|
event | Event |
void
▸ Private
onPublicMessage(event
): void
Name | Type |
---|---|
event | MessageEvent <any > |
void
▸ Private
onVisibilityChange(): void
void
▸ onceSubscribe(params
, callback
): void
Name | Type |
---|---|
params | any |
callback | Omit <WSMessageHandler , "onUnsubscribe" > |
void
▸ openPrivate(accountId
): void
Name | Type |
---|---|
accountId | string |
void
▸ privateSubscribe(params
, callback
): () => void
Name | Type |
---|---|
params | any |
callback | WSMessageHandler | Omit <WSMessageHandler , "onUnsubscribe" > |
fn
▸ (): void
void
▸ Private
reconnectPrivate(): void
void
▸ Private
reconnectPublic(): void
void
▸ send(message
): void
Name | Type |
---|---|
message | any |
void
▸ subscribe(params
, callback
, once?
, id?
): undefined
| unsubscribe
Name | Type |
---|---|
params | any |
callback | WSMessageHandler | Omit <WSMessageHandler , "onUnsubscribe" > |
once? | boolean |
id? | string |
undefined
| unsubscribe
▸ Private
unsubscribe(parmas
, webSocket
, handlerMap
): void
Name | Type |
---|---|
parmas | MessageParams |
webSocket | WebSocket |
handlerMap | Map <string , Topics > |
void
▸ Private
unsubscribePrivate(parmas
): void
Name | Type |
---|---|
parmas | MessageParams |
void
▸ Private
unsubscribePublic(parmas
): void
Name | Type |
---|---|
parmas | MessageParams |
void