Directus / @directus/sdk / realtime / WebSocketClient
Interface: WebSocketClient<Schema> ​
Type Parameters ​
• Schema
Methods ​
connect() ​
connect():
Promise
<WebSocketInterface
>
Returns ​
Promise
<WebSocketInterface
>
Defined in ​
disconnect() ​
disconnect():
void
Returns ​
void
Defined in ​
onWebSocket() ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: "open"
• callback
Returns ​
Defined in ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: "error"
• callback
Returns ​
Defined in ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: "close"
• callback
Returns ​
Defined in ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: "message"
• callback
Returns ​
Defined in ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: WebSocketEvents
• callback: WebSocketEventHandler
Returns ​
Defined in ​
sendMessage() ​
sendMessage(
message
):void
Parameters ​
• message: string
| Record
<string
, any
>
Returns ​
void
Defined in ​
subscribe() ​
subscribe<
Collection
,Options
>(collection
,options
?):Promise
<object
>
Type Parameters ​
• Collection extends string
| number
| symbol
• Options extends SubscribeOptions
<Schema
, Collection
>
Parameters ​
• collection: Collection
• options?: Options
Returns ​
Promise
<object
>
subscription ​
subscription:
AsyncGenerator
<SubscriptionOutput
<Schema
,Collection
,Options
["query"
],Fallback
<Options
["event"
],SubscriptionOptionsEvents
> |"init"
,Options
["query"
] extendsQuery
<Schema
,Schema
[Collection
]> ?IfAny
<Schema
,Record
<string
,any
>, { [K in string | number | symbol]: Merge<MappedFunctionFields<(...), (...)> extends FF ? MapFlatFields<(...), (...), (...)> : never, PickRelationalFields<(...)> extends never ? never : { [Field in (...)]: (...) }>[K] }> :Partial
<Schema
[Collection
]>>,void
,unknown
>
unsubscribe() ​
Returns ​
void