Web sockets and BaseX
Monday, 31 October 2016 · 4 messages · last reply 3 Nov 2016
FB
France Baril31 Oct 2016 11:20 #
Has anyone implemented a solutions that uses web sockets with BaseX? I've been doing some work with socket.io and node.js, but all the research I've done on Jetty points to the need to create .java files that manage the connection on the server side. Does that mean I'd need a BaseX module to manage that? Since Jetty seems to support web sockets, do you forsee any other issues specific to BaseX?
--
France Baril
Architecte documentaire / Documentation architect
france.baril at architextus.com
ML
Marco Lettere31 Oct 2016 15:46 #
Hi France,
I can confirm that for using websocket you'll have to write some Java code. That's what we've done for creating a Jetty Connector that is able to accept websocket connections from HTML5 apps running inside browsers. Then we interact from inside XQuery by using the mechanism of Java Bindings [1] when we have to send out messages.
We used Jetty package that comes with Basex just adding [2] to the lib folder.
The only caveat we stumbled upon is, hope I'm recalling the right story here, that it's not possible to just add a new Connector to the jetty.xml file because BaseX ignores every connector but the first one [3] (I ask Christian to possibly confirm or confute this). Thus we needed to configure the Jetty connector from inside the Java code which is not optimal for us but works.
Hope this helps.
Ciao,
Marco.
[1] http://docs.basex.org/wiki/Java_Bindings
[2] jetty-websocket-8.1.18.v20150929.jar
[3]
https://github.com/dcore94/basex/blob/master/basex-api/src/main/java/org/basex/BaseXHTTP.java#L100
Quoted text · France Baril · 13 lines
On 31/10/2016 10:19, France Baril wrote: > Has anyone implemented a solutions that uses web sockets with BaseX? > I've been doing some work with socket.io <http://socket.io> and > node.js, but all the research I've done on Jetty points to the need to > create .java files that manage the connection on the server side. Does > that mean I'd need a BaseX module to manage that? Since Jetty seems to > support web sockets, do you forsee any other issues specific to BaseX? > > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com <mailto:france.baril at architextus.com>
CG
Christian Grün31 Oct 2016 15:47 #
Hi Marco, hi France,
Thanks for the feedback on creating web sockets. Feel free to tell us how the BaseX code could be modified to get it embedded more smoothly.
Best,
Christian
Quoted text · Marco Lettere · 43 lines
On Mon, Oct 31, 2016 at 3:46 PM, Marco Lettere <m.lettere at gmail.com> wrote: > Hi France, > I can confirm that for using websocket you'll have to write some Java code. > That's what we've done for creating a Jetty Connector that is able to accept > websocket connections from HTML5 apps running inside browsers. > Then we interact from inside XQuery by using the mechanism of Java Bindings > [1] when we have to send out messages. > > We used Jetty package that comes with Basex just adding [2] to the lib > folder. > The only caveat we stumbled upon is, hope I'm recalling the right story > here, that it's not possible to just add a new Connector to the jetty.xml > file because BaseX ignores every connector but the first one [3] (I ask > Christian to possibly confirm or confute this). Thus we needed to configure > the Jetty connector from inside the Java code which is not optimal for us > but works. > > Hope this helps. > Ciao, > Marco. > > [1] http://docs.basex.org/wiki/Java_Bindings > [2] jetty-websocket-8.1.18.v20150929.jar > [3] > https://github.com/dcore94/basex/blob/master/basex-api/src/main/java/org/basex/BaseXHTTP.java#L100 > > > On 31/10/2016 10:19, France Baril wrote: > > Has anyone implemented a solutions that uses web sockets with BaseX? I've > been doing some work with socket.io and node.js, but all the research I've > done on Jetty points to the need to create .java files that manage the > connection on the server side. Does that mean I'd need a BaseX module to > manage that? Since Jetty seems to support web sockets, do you forsee any > other issues specific to BaseX? > > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com > >
FB
France Baril3 Nov 2016 05:56 #
Thank you for the answers. I'm really happy to know this can work. I'm not knowledgeable in java at all, but now I know what to look for and/or what to ask for if I end up hiring someone.
This is precious!
Quoted text · Christian Grün · 62 lines
El 31 oct. 2016 09:48, "Christian Grün" <christian.gruen at gmail.com> escribió: > Hi Marco, hi France, > > Thanks for the feedback on creating web sockets. Feel free to tell us > how the BaseX code could be modified to get it embedded more smoothly. > > Best, > Christian > > > On Mon, Oct 31, 2016 at 3:46 PM, Marco Lettere <m.lettere at gmail.com> > wrote: > > Hi France, > > I can confirm that for using websocket you'll have to write some Java > code. > > That's what we've done for creating a Jetty Connector that is able to > accept > > websocket connections from HTML5 apps running inside browsers. > > Then we interact from inside XQuery by using the mechanism of Java > Bindings > > [1] when we have to send out messages. > > > > We used Jetty package that comes with Basex just adding [2] to the lib > > folder. > > The only caveat we stumbled upon is, hope I'm recalling the right story > > here, that it's not possible to just add a new Connector to the jetty.xml > > file because BaseX ignores every connector but the first one [3] (I ask > > Christian to possibly confirm or confute this). Thus we needed to > configure > > the Jetty connector from inside the Java code which is not optimal for us > > but works. > > > > Hope this helps. > > Ciao, > > Marco. > > > > [1] http://docs.basex.org/wiki/Java_Bindings > > [2] jetty-websocket-8.1.18.v20150929.jar > > [3] > > https://github.com/dcore94/basex/blob/master/basex-api/ > src/main/java/org/basex/BaseXHTTP.java#L100 > > > > > > On 31/10/2016 10:19, France Baril wrote: > > > > Has anyone implemented a solutions that uses web sockets with BaseX? I've > > been doing some work with socket.io and node.js, but all the research > I've > > done on Jetty points to the need to create .java files that manage the > > connection on the server side. Does that mean I'd need a BaseX module to > > manage that? Since Jetty seems to support web sockets, do you forsee any > > other issues specific to BaseX? > > > > > > -- > > France Baril > > Architecte documentaire / Documentation architect > > france.baril at architextus.com > > > > >
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery