GithubHelp home page GithubHelp logo

jawampa on jetty? about jawampa HOT 3 OPEN

zhuker avatar zhuker commented on June 24, 2024
jawampa on jetty?

from jawampa.

Comments (3)

Matthias247 avatar Matthias247 commented on June 24, 2024

You need to implement a connection provider (similar to the netty connection provider which is contained in the jawampa-netty directory). This connection provider needs to implement the interfaces in the ws.wamp.jawampa.connection in order to push messages towards jawampa-core. The most important thing is IWampConnection, which you need to map to a Jetty websocket connection. If you only need the server side you don't need to implement the client-side interfaces and it should not be too much work.

from jawampa.

zhuker avatar zhuker commented on June 24, 2024

yeah, i need server side only
i am very new to jawampa codebase so i cant tell right off the bat which interfaces are server-side
do you have a list i would need to implement?

from jawampa.

Matthias247 avatar Matthias247 commented on June 24, 2024

I'm a little bit out of this project since I'm not actively working on it and have last touched it many month ago. But as far as I see it's only the IWampConnection one. Your jetty adapter has to accept websocket connections, needs to wrap them in IWampConnection interfaces and register them at the router. See here https://github.com/Matthias247/jawampa/blob/master/jawampa-netty/src/main/java/ws/wamp/jawampa/transport/netty/WampServerWebsocketHandler.java#L134-L187 for the wrapped class and later on https://github.com/Matthias247/jawampa/blob/master/jawampa-netty/src/main/java/ws/wamp/jawampa/transport/netty/WampServerWebsocketHandler.java#L243-L247 for registering at the router.

  • Important things as far as I can remember: The router and your websocket handler live in different threads. Therefore the calls between them must be threadsafe. The jawampa core interfaces IWampConnectionAcceptor and IWampConnectionListener are thread safe (if you call them the messages are put into a queue in the Routers thread) - be sure your IWampConnection methods are too.
  • Send and close methods are async. Be sure to fulfill the promises when you have finished the operation (and only then). Only after you have sent one message jawampa will give you the next.
  • jawampa will always call close() on the connection. Even after you have signaled a close to it.
  • Don't do weird things like calling messageReceived after transportClosed.
  • You need to do serialization and deserialization in your adapter. It isn't efficient to do it in jawampa core because we would then need to copy the Byte Buffers (whose datatype is networking library specific) into some general format. See WampSerializationHandler and WampDeserializationHandler for how it works. As all the heavy lifting is done by jackson anyway it's also not that complicated.

from jawampa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.