Changes

Jump to navigation Jump to search
No change in size ,  15:13, 4 August 2018
no edit summary
==Preliminaries==
There are a bunch of Annotations annotations depending to WebSockets for annotating XQuery functions. When a WebSocket-Message message comes in, an XQuery function will be invoked that matches the constraints indicated by its annotations.
If a WebSocket Function function is requested (like connecting to the Path '/', message to the Path '/path', ...), the module directory and its sub-directories will be traversed, and all [[XQuery Extensions#Suffixes|XQuery files]] will be parsed for functions with WebSocket annotations. Sub-directories that include an {{Code|.ignore}} the file will be skipped.
To speed up processing, the functions of the existing XQuery modules are automatically cached in main memory:
=Usage=
* Enable the WebSocket Servlet servlet in the web.xml. You can set here the maxIdleTime, maxTextMessageSize and maxBinaryMessageSize too.
* If you get a message that exceeds the maxTextMessageSize/maxBinaryMessageSize or, if not set, the default messageSize of Jetty of 65 536 bytes (64 kB) then the connection will close. In this case, the websocket:error annotation will be called.
<pre class="brush:xml">
=Annotations=
==websocket:connect(path)==
Called when a Client-client WebSocket-Connection connection successfully connected to the server. The <code>path</code> specifies the path the Client client connected to.
==websocket:message(path,message)==
Called when a <code>message</code> arrives at the Serverserver. The <code>path</code> specifies the <code>path</code> the Client client is connected to. The <code>message</code> is the <code>message</code> sent by the Clientclient. Could be a Texttext-Message message or a Binarybinary-Messagemessage.
==websocket:close(path)==
Called when the WebSocket closes. The <code>path</code> specifies the <code>path</code> the Client client is connected to.The WebSocket is already closed when this Annotation annotation is called so there can be no return.
==websocket:error(path,message)==
Called when an Error error occurred. Usually, this happens because of bad/malformed incoming packets. The <code>path</code> specifies the <code>path</code> the Client client is connected to. The <code>message</code> is the Errorerror-Messagemessage.
The WebSocket gets closed after an error occurred.
administrator, editor
23

edits

Navigation menu