Changes

Jump to navigation Jump to search
403 bytes added ,  14:20, 20 July 2022
no edit summary
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:id||xs:string}}
|-valign="top"
| '''Summary'''
|Returns the ID of the current WebSocket.
|-valign="top"
| '''Errors'''
|{{Error|not-found|#Errors}} No WebSocket with the specified id exists.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:ids||xs:string*}}
|-valign="top"
| '''Summary'''
|Returns the ids of all currently registered WebSockets.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:path|$id as xs:string|xs:string}}
|-valign="top"
| '''Summary'''
|Returns the path of the WebSocket with the specified {{Code|$id}}.
|-valign="top"
| '''Errors'''
|{{Error|not-found|#Errors}} No WebSocket with the specified id exists.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:close|$id as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Closes the connection of the WebSocket with the specified {{Code|$id}}.
|-valign="top"
| '''Errors'''
|{{Error|not-found|#Errors}} No WebSocket with the specified id exists.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:send|$message as item(), $ids as xs:string*|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Sends a <code>$message</code> to the clients with the specified <code>$ids</code>. Ids that cannot be assigned to clients will be ignored. The message will be handled as follows:
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:broadcast|$message as xs:anyAtomicType|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Broadcasts a <code>$message</code> to all connected clients except to the caller. Invocations of this convenience function are equivalent to <code>ws:send($message, ws:ids()[. != ws:id()])</code>. See {{Function||ws:send}} for more details on the message handling.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:emit|$message as xs:anyAtomicType|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Emits a <code>$message</code> to all connected clients. Invocations of this function are equivalent to <code>ws:send($message, ws:ids())</code>. See {{Function||ws:send}} for more details on the message handling.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:eval|$query as xs:anyAtomicType|xs:string}}<br />{{Func|ws:eval|$query as xs:anyAtomicType, $bindings as map(*)?|xs:string}}<br />{{Func|ws:eval|$query as xs:anyAtomicType, $bindings as map(*)?, $options as map(*)?|xs:string}}<br />
|-valign="top"
| '''Summary'''
|Schedules the evaluation of the supplied {{Code|$query}} and returns the result to the calling WebSocket client. The query can be a URI or a string, and variables and context items can be declared via {{Code|$bindings}} (see {{Function|XQuery|xquery:eval}} for more details). The following {{Code|$options}} can be supplied:
* {{Code|id}}: sets a custom job id. The id must not start with the standard <code>job</code> prefix, and it can only be assigned if no job with the same name exists.
Query scheduling is recommendable if the immediate query execution might be too time consuming and lead to a timeout.
|-valign="top"
| '''Errors'''
|{{Error|overflow|#Errors}} Query execution is rejected, because too many jobs are queued or being executed. <br/>{{Error|id|#Errors}} The specified id is invalid or has already been assigned.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:get|$id as xs:string, $name as xs:string|item()*}}<br/>{{Func|ws:get|$id as xs:string, $name as xs:string, $default as item()*|item()*}}
|-valign="top"
| '''Summary'''
|Returns the value of an attribute with the specified {{Code|$name}} from the WebSocket with the specified {{Code|$id}}. If the attribute is unknown, an empty sequence or the optionally specified {{Code|$default}} value will be returned instead.
|-valign="top"
| '''Errors'''
|{{Error|not-found|#Errors}} No WebSocket with the specified id exists.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:set|$id as xs:string, $name as xs:string, $value as item()*|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Returns the specified {{Code|value}} of the attribute with the specified {{Code|$name}} from the WebSocket with the specified {{Mono|$id}}.
|-valign="top"
| '''Errors'''
|{{Error|not-found|#Errors}} No WebSocket with the specified id exists.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|ws:delete|$id as xs:string, $name as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Deletes an attribute with the specified {{Code|$name}} from the WebSocket with the specified {{Mono|$id}}.
|-valign="top"
| '''Errors'''
|{{Error|not-found|#Errors}} No WebSocket with the specified id exists.
! width="110"|Code
|Description
|-valign="top"
|{{Code|not-found}}
|No WebSocket with the specified id exists.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu