play2-sockjs icon indicating copy to clipboard operation
play2-sockjs copied to clipboard

API reference for 0.6.x is missing

Open Flo354 opened this issue 8 years ago • 5 comments

It seems there are breaking changes from 0.5.x to 0.6.x

For instance, there is no method withActor. @Override public SockJS sockjs() { SockJS.withActor(MySockJSActor::props); }

It would be nice to have a documentation.

Thanks,

Flo354 avatar Jun 07 '17 15:06 Flo354

Okay... As simple as that :

    @Singleton
    public final class AuthorizationSockJSRouter extends SockJSRouter {

        private final ActorSystem system;

        private final Materializer materializer;

        @Inject
        AuthorizationSockJSRouter(ActorSystem system, Materializer materializer) {
            this.system = system;
            this.materializer = materializer;
        }

        @Override
        public SockJS sockjs() {
            return SockJS.Text.accept(request ->
                    ActorFlow.actorRef(MyActor::props, system, materializer));
        }
    }

Flo354 avatar Jun 07 '17 17:06 Flo354

Hi, sorry for the delay.

I removed all API that were deprecated in 0.5. SockJS.withActor was returning a SockJS implementation based on callback, both have been replaced by an API that expose directly the streaming interface.

I'll update the documentation for the 0.6 release as soon as it will be stable. Do not expect any big change besides those regarding on how to inject the Materializer, DefaultActionBuilder and PlayBodyParsers into the SockJSRouter to integrate better the new Play 2.6 architecture.

fdimuccio avatar Jun 11 '17 19:06 fdimuccio

Thanks for your answer!

Actually, you are using the same way than Play 2.6 : HandlingWebSockets with actors

Flo354 avatar Jun 12 '17 16:06 Flo354

Yes, one goal of this project is to have a set of api that mirror the one provided by Play. In this way it is straightforward to switch from Play WebSocket to play2-sockjs (or viceversa).

fdimuccio avatar Jun 12 '17 18:06 fdimuccio

Thanks.

You can close the issue or let it open until you add the documentation :)

Flo354 avatar Jun 13 '17 15:06 Flo354