Directus / @directus/sdk / realtime / WebSocketClient
Interface: WebSocketClient<Schema> ​
Type parameters ​
• Schema
Methods ​
connect() ​
connect():
Promise
<WebSocketInterface
>
Returns ​
Promise
<WebSocketInterface
>
Source ​
disconnect() ​
disconnect():
void
Returns ​
void
Source ​
onWebSocket() ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: "open"
• callback
Returns ​
Source ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: "error"
• callback
Returns ​
Source ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: "close"
• callback
Returns ​
Source ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: "message"
• callback
Returns ​
Source ​
onWebSocket(event, callback) ​
onWebSocket(
event
,callback
):RemoveEventHandler
Parameters ​
• event: WebSocketEvents
• callback: WebSocketEventHandler
Returns ​
Source ​
sendMessage() ​
sendMessage(
message
):void
Parameters ​
• message: string
| Record
<string
, any
>
Returns ​
void
Source ​
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
>,Merge
<MappedFunctionFields
<Schema
,UnpackList
<IfAny
<..., ..., ...>>> extendsFF
?MapFlatFields
<UnpackList
<IfAny
<..., ..., ...>>,FieldsWildcard
<UnpackList
<...>,Exclude
<..., ...>>,FF
extendsRecord
<..., ...> ?FF
<...> :Record
<..., ...>> :never
,PickRelationalFields
<UnpackList
<Mutable
<...>>> extendsnever
?never
:{ [Field in string | number | symbol]: Field extends keyof (...) ? (...) extends (...) ? (...) : (...) : never }
>> :Partial
<Schema
[Collection
]>>,void
,unknown
>unsubscribe() ​
Returns ​
void