Changes

Jump to navigation Jump to search
2,514 bytes added ,  18:49, 1 August 2018
Created page with "This XQuery Module contains functions for accessing specific WebSocket-Functions and setting Attributes on a WebSocket-Connection. This module is mainly useful..."
This [[Module Library|XQuery Module]] contains functions for accessing specific WebSocket-Functions and setting Attributes on a WebSocket-Connection. This module is mainly useful in the context of [[WebSockets]].

=Conventions=

* The {{Code|basex-api}} package must be included in the classpath. This is always the case if you use one of the complete distributions (zip, exe, war) of BaseX.
* All functions and errors are assigned to the <code><nowiki>http://basex.org/modules/websocket</nowiki></code> namespace. The module must be imported in the query prolog:
<pre class="brush:xquery">
import module namespace session = "http://basex.org/modules/websocket";
...
</pre>

=Functions=

==websocket:broadcast==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|websocket:broadcast|$message as xs:anyAtomicType|empty-sequence()}}
|-
| '''Summary'''
|Broadcasts <code>message</code> which may be of type xs:string, xs:base64Binary, or xs:hexBinary to all connected Members exept to the caller.
|}

==websocket:id==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|websocket:id||xs:string}}
|-
| '''Summary'''
|Returns the ID of the current Websocket Connetion.
|}

==websocket:get==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|websocket:get|$key as xs:string|xs:string}}
|-
| '''Summary'''
|Returns the Websocket Attribute with the key <code>$key</code>. If the <code>$id</code> Parameter is set, it returns the Attribute of a Specific User with the ID <code>$id</code>
|}

==websocket:set==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|websocket:set|$key as xs:string, $value as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Sets a Websocket Attribute with the key <code>$key</code> and the value $value. If the <code>$id</code> Parameter is set, the Attribute of a specific User with the ID <code>$id</code> is set.
|}

==websocket:delete==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|websocket:delete|$key as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Removes a Session Attribute from the current WebsocketClient. If the <code>$id</code> Parameter is set, the Attribute of a specific User with the ID <code>$id</code> will be deleted.
|}

==websocket:path==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|websocket:path||xs:string}}
|-
| '''Summary'''
|Returns the Path of the current WebsocketClient. If the <code>$id</code> Parameter is set, the Path of a specific User with the ID <code>$id</code> will be returned.
|}
administrator, editor
23

edits

Navigation menu