Changes

Jump to navigation Jump to search
163 bytes removed ,  19:42, 13 August 2018
no edit summary
|-
| '''Summary'''
|Sends a <code>$message</code> which may be of type xs:string, xs:base64Binary, or xs:hexBinary to the user(s) with the ID(s) <code>$ids</code>
|}
|-
| '''Summary'''
|Broadcasts <code>$message</code> which may be of type xs:string, xs:base64Binary, or xs:hexBinary to all connected clients except to the caller.
|}
|-
| '''Summary'''
|Returns the ID of the current WebSocket client WebSocket connection.
|}
|-
| '''Summary'''
|Returns the IDs ids of all current currently registered WebSocket connectionsclient.
|}
|-
| width='120' | '''Signatures'''
|{{Func|ws:path||xs:string}}<br>{{Func|ws:path|$id as xs:string|xs:string}}
|-
| '''Summary'''
|Returns the path of the current WebSocketClient.|} ==ws:path== WebSocket client, or the client with the specified {| width='100%'|-| width='120' | '''Signatures'''|{{Func|ws:pathCode|$id as xs:string|xs:string}}|-| '''Summary'''|Returns the path of specific user with the ID <code>$id</code>.
|}
<pre class="brush:xquery">
module namespace websocketexample = 'http://basex.org/modules/web-page';
(: Import the WebSocket module :)
import module namespace ws = "http://basex.org/modules/Websocket";
declare
%ws:connect("/")
function websocketexamplelocal:connect() as empty-sequence() {
let $client-id := ws:id()
let $client-path := ws:path()
declare
%ws:message("/","{$message}")
function local:message(
$message as xs:string
) as xs:string empty-sequence() {
let $client-ids := ws:ids()
let $fist-client-id := fn:head($client-ids)
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu