Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing the SockJsMessageCodec in WebSocket Java config and XML namespace [SPR-12091] #16707

Closed
spring-projects-issues opened this issue Aug 18, 2014 · 2 comments
Assignees
Labels
in: messaging in: web type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Aug 18, 2014

Ben Barron opened SPR-12091 and commented

Spring Messaging (Websockets) is intended to have the ability to work without Jackson on the classpath, however it is still required to deserialize/serialize the SockJs frames because, as far as I can tell, there isn't a way to easily call TransportHandlingSockJsService.setMessageCodec() and provide your own implementation based on whatever serializer you wish to use.

I believe the .setMessageCodec() method should be present on the SockJsServiceRegistration builder which in turn would set it upon creation of the TransportHandlingSockJsService in the SockJsServiceRegistration.createSockJsService() method.

This will allow you to do the following:

@Override
protected void registerStompEndpoints(StompEndpointRegistry registry) {
     registry.addEndpoint("/sockjs").withSockJS().setMessageCodec(...);
}

Affects: 4.0.6, 4.0.7

Reference URL: http://stackoverflow.com/questions/25349589/spring-messaging-websockets-how-to-call-setmessagecodec

Referenced from: commits 2a0765e

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 18, 2014

Rossen Stoyanchev commented

Are you trying to configure Gson-based codec or some other? If you have an implementation already, perhaps we can just that and use it automatically depending on which library is on the classpath.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 18, 2014

Ben Barron commented

Actually I am planning on using it with Genson: http://owlike.github.io/genson/.

@spring-projects-issues spring-projects-issues added in: messaging type: enhancement in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.1 GA milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging in: web type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants