Changes

Jump to navigation Jump to search
488 bytes added ,  14:14, 22 October 2018
==%ws:message(path, message)==
Called when a <code>client message</code> arrives at the server. The <code>path</code> specifies the path which a client is connected to.The <code>message</code> string contains the name of the variable to which the message will be bound:
The <codepre class="brush:xquery">declare %ws:message<('/code> is the <code>', '{$info}') function local:message($info) { };</codepre> sent by the client. It  The value will be of type <code>xs:string</code> or <code>xs:base64Binary</code>. The As there is no fixed message protocol, the client needs to take care of the message syntax. ==%ws:error(path, and it must not exceed message)== Called when an error occurs. The <code>path</code> specifies the path which a client is connected to. The <code>message</code> string contains the name of the variable to which the message will be bound: <pre class="brush:xquery">declare %ws:error('/', '{$error}') function local:error($error) { };</pre> Usually, errors happen because of bad/malformed incoming packets. The WebSocket connection gets closed after the configured maximum sizeerror handling.
==%ws:close(path)==
The WebSocket is already closed when this annotation is called so there can be no return.
==%ws:errorheader-param(pathname, messagevariable[, default])==
Called when an error occursFor accessing connection-specific properties like the HTTP version. The value will be bound to the specified <code>pathvariable</code> specifies . If the path which a client is connected to. Usuallyproperty has no value, errors happen because of bad/malformed incoming packets. The an optional <code>messagedefault</code> is the error message. The WebSocket connection gets closed after the error handling. ==%wsvalue will be assigned instead:header-param(name, variable[, default])==
For accessing connection-specific properties like the HTTP version. The value will be bound to the specified <codepre class="brush:xquery">variable</code>. If no value is availabledeclare %ws:close('host', '{$host}') %ws:header-param('host', an optional <code>default'{$host}')function local:close($host) { admin:write-log('Connection was closed: ' || $host)};</codepre> value will be bound instead.
The following parameters are available:
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu