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

Support WebSocket in Spring Boot example #845

Closed
qq61966100 opened this Issue Mar 13, 2019 · 12 comments

Comments

Projects
None yet
2 participants
@qq61966100
Copy link

qq61966100 commented Mar 13, 2019

Hi, I`m new to spring boot and cometd, some issue after I download the spring boot example
after I run the application, console showed below message
'o.c.server.BayeuxServerImpl.1d035be3 : JSR 356 WebSocket classes available, but org.cometd.websocket.server.WebSocketTransport unavailable: JSR 356 WebSocket transport disabled'
and when I go to the url 'localhost:8080/cometd', response was 400, anyone can help me? why I got this issue?

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 13, 2019

Image 12

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 13, 2019

by the way, I changed the pom.xml, because 'cometd-java-examples-embedded' used project version, but can not found, so I changed it to version 4.0.3

@sbordet

This comment has been minimized.

Copy link
Member

sbordet commented Mar 13, 2019

Thanks for reporting this, I will make sure that the Spring Boot example will work with WebSocket too.
The change requires a new dependency in the POM and a little bit of new code in the application class.

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 14, 2019

Got it, many thanks, and waiting for the new version.

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 14, 2019

And any existing solution for the cometd if I want to change my project from spring to springboot ?
Can I keep the old way in spring ? But I tried it, the error message is can not found servletcontext

@sbordet sbordet changed the title spring boot eg question Support WebSocket in Spring Boot example Mar 14, 2019

sbordet added a commit that referenced this issue Mar 14, 2019

Issue #845 - Support WebSocket in Spring Boot example.
Updated the example and dependencies to use also WebSocket.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet

This comment has been minimized.

Copy link
Member

sbordet commented Mar 14, 2019

@qq61966100 with commit 6a63498 I have updated the Spring Boot example to use WebSocket, thus getting rid of the warning you were seeing.
The changes interesting for you are the changed in CometDApplication and in the POM.

Let me know if those changes work for you too.

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 15, 2019

image
@sbordet Thanks for your support, And why the project version is 4.0.4, but plugin latest version is 4.0.3 in maven ? And If I changed version manually the pom.xml occurred another error

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 15, 2019

sorry, I changed version to 4.0.3 , then clean the cache, The build error disappeared , and may I know how to test ? I tried to use the url 'localhost:8080/cometd' , is it correct? but I got 400
image

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 15, 2019

And I tried to use junit, It looks fine

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 15, 2019

image
Although I got the 'yahoo', but junit test failed

@sbordet

This comment has been minimized.

Copy link
Member

sbordet commented Mar 15, 2019

@qq61966100 you have to build the latest CometD code, see https://docs.cometd.org/current/reference/#_build.

Once you have done that, you can reference CometD 4.0.4-SNAPSHOT in your project, or run the tests that should pass cleanly.

Mixing 4.0.4-SNAPSHOT with CometD 4.0.3 won't work because while I was working on this issue I discovered #849, so you really need the latest CometD code.

@qq61966100

This comment has been minimized.

Copy link
Author

qq61966100 commented Mar 15, 2019

@sbordet Got it, Let me try it follow the guide, so lets close this issue, and any further question Ill open new issue then, many thanks for your patient and support

@qq61966100 qq61966100 closed this Mar 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.