JSR-356 | JSR 356 WebSocket | Websocket library
kandi X-RAY | JSR-356 Summary
kandi X-RAY | JSR-356 Summary
This repository contains a client-server version of the TicTacToe game. The server depends on javax.websocket-api 1.0-b13 and on tyrus-1.0-b12. Also, tyrus-1.0-b12 depends on javax.websocket-api-1.0-b13 which is NOT the latest version of the specification. At this moment, the latest promoted build of GlassFish (b78) is shipped with tyrus-1.0-b12 and javax.websocket-api-1.0-b13. Hence, in order to run the server, you can simply install GlassFish 4 b78 Currently, we have 4 clients: * A JavaFX 2.x client, depending on the same javax.websocket-api 1.0-b13. * An HTML 5 client, leveraging Angular.js * An iOS client * An Android client. All these clients can connect to the same backend.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of JSR-356
JSR-356 Key Features
JSR-356 Examples and Code Snippets
Community Discussions
Trending Discussions on JSR-356
QUESTION
I have implemented a websocket client program using tyrus referring this example. There it was implemented in a assynchronous way. Now I want make it synchronous so that once I send a request, program will wait till the response received. Is it possible with tyrus framework? If so, how cam I do it? Below is my implementation of client program
...ANSWER
Answered 2020-Jun-09 at 07:28There is no such thing as "synchronous websocket" as it's a whole different messaging protocol than HTTP. While HTTP is a request-response protocol, where you expect a response from the client once you sent the request, WebSocket establishes a connection using a handshake request, after which the communication becomes bidirectional where there is no concept of response to a request. You can read more about it in Wikipedia.
QUESTION
Is it possible to have all 3 (Websocket, REST Servlet, and a File server) all on the same port?
I've been going through the web finding lots of examples of partial solutions, but the Jetty setup has so many variations that it's hard to determine what will work for me.
I'd prefer to use JSR-356 websocket api rather than the Jetty proprietary, in case I have to move to a different server later.
...ANSWER
Answered 2019-Sep-17 at 21:27Yes, and it easiest if the HTTP paths are different.
- WebSocket on
/ws/*
- REST on
/api/*
- Static File Serving on
/static/*
(or just on/
, which means for all requests that don't start with/ws/
or/api/
)
But if you don't want to use paths, then you have to use some other separator of the requests.
- WebSocket upgrade is a GET with a
Connection: upgrade
so that won't conflict with either the REST or file serving. - REST can easily conflict with file serving if the paths overlap. (if the client asks for
/stuff/here
and you have REST setup on/*
then what does that request mean? REST or static files?) - File serving is traditionally handled by the servlet spec default url-pattern of
/
, which means if no other url-pattern has been designated to handle the requested HTTP path, then static files are served.
This is advice:
- Don't overlap your url-patterns.
- Use separate paths for each. (you'll thank yourself later)
- Don't make REST serve static files (this is super inefficient and a hack at best).
QUESTION
I want to deploy a spring boot application on weblogic. I have this error:
Erreur javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable Erreur Not running on Jetty, JSR-356 support unavailable
Spring boot version 1.5.20 / weblogic Version 12c
can you help me???
code of main
...ANSWER
Answered 2019-Aug-06 at 15:04To run on weblogic you need to customize some packages in your weblogic.xml because Spring has some conflicts with weblogic libraries. Here is an example I used before, but this is not the only packages you may need to add to this file, it depends on what libraries your project will need.
QUESTION
I'd like to deploy webapp, packaged as WAR having web.xml
in it, to Jetty server.
Within that app, I'd like to be able to have a JSR-356 specified javax websocket endpoints configured. I prefer, that those endpoints to be provided via ServerEndpointConfig
, not an annotation scan.
There are many resources exemplifying that with an embedded Jetty, utilizing already famous WebSocketServerContainerInitializer.configureContext(context);
API. I can't do that, obviously.
There are others, jumping directly to ServletContextListener
and obtaining the ServerContainer
via famous context.getAttribute("javax.websocket.server.ServerContainer"
). So far I'm getting pretty much NULL
via this API, so obviously container is not added.
What is that bit of configuration that is missing? Can it be done, preferably, via web.xml
? If it is about config files like jetty.xml
or jetty.ini
- example would be nice, again, preferably for xml
syntax.
As per answer below (the accepted one) and as I've actually tried to describe here - the known way of configuration is absolutely working just fine. Saying known I mean either by adding --module=websocket
to some *.ini
file for a non-embedded Jetty, or by calling WebSocketServerContainerInitializer.configureContext
for an embedded one.
So rephrasing the question: is there any experience/knowledge from someone to enable websocket module by purely XML
based configuration?
ANSWER
Answered 2018-Nov-30 at 14:18If using the ${jetty.base}
and ${jetty.home}
recommended installation process for Standalone Jetty, you should go to your ${jetty.base}
instance directory and enable the websocket
module.
QUESTION
Note: This is a cross post because I wasn't sure if this was a technical issue or a bug so the bug can be found here
A couple weeks ago I wrote up a prototype for adding a flexible environment service to our appengine project that is primarily standard environment services. The prototype was based on the java quickstart sample "HelloworldSpringBoot" with some minor modifications.
After my success with the prototype I moved over to a more production set of code for this service, developed it for a couple weeks and attempted to deploy on Jan 12th, 4 days ago. The app refused to start and after several attempts at simplifying the app to just a single route I could not get the app to start.
I switch back to the prototype code, deployed to the original project that code was working in and am seeing the same behavior where the app is not starting.
There is no one error message to point to so I have a couple that I'll list here that may be the culprit.
The first is the most obvious, but may be a generic catch-all:
...ANSWER
Answered 2018-Jan-17 at 21:51The solution ended up being a little bit magical, but the SpringBoot documentation was telling once the appengine standard documentation pointed me in the right direction.
Note that a WebApplicationInitializer is only needed if you are building a war file and deploying it. If you prefer to run an embedded container then you won't need this at all.
We were deploying a war and locally it was running with the embedded container. After setting jetty as provided and adding the magical SpringBootServletInitializer to the root, things started working. I don't know why this was not needed two weeks ago, but it is definitely needed now.
QUESTION
I am in the process of upgrading our jetty from 9.2.24 to 9.4.10, for an app that works extensively with websockets.
I have an existing test (junit) that sets embedded jetty, registers to it rest resource and websocket servlet and then tests to see if they can be accessed.
The test works perfectly well when jetty is at version 9.2.24. An attempt to move to version 9.4.10 with the very same code fails with
...ANSWER
Answered 2018-Jun-21 at 11:41Your request headers looks like this ...
QUESTION
I am trying to convert a springboot project to run on GAE. So far, I am able to connect the project to cloud sql locally.
However, when making the conversion to app engine standard(to deploy it) following several guides/tutorials such as
I see the following exception whenever I start the GAE dev server, or deploy.
...ANSWER
Answered 2018-Mar-11 at 06:23I am still unsure why the websocket error occurred, but for me it was fixed by doing the following 2 steps:
1 Upgrade spring-boot-starter-parent version
QUESTION
How do I properly close a websocket and and provide a clean, informative response to the client when an internal error occurs on my server? In my current case, the client must provide a parameter when it connects, and I am trying to handle incorrect or missing parameters received by OnOpen.
This example suggests I can just throw an exception in OnOpen, which will ultimately call OnError where I can close with a reason and message. It kinda works, but the client only receives an EOF, 1006, CLOSE_ABNORMAL.
Also, because I have found no other discussion, I can't tell what might be best practice.
I'm using the JSR-356 spec, as follows:
...ANSWER
Answered 2017-Sep-09 at 18:35I believe I should have placed...
QUESTION
My current web server is embedded Jetty 9.1.5. It works well with JSR-356 to create websocket. These days, I am trying to upgrade to Jetty 9.4.1. Everything works nicely except websocket.
My code like below:
- Embedded Jetty and Websocket libs:
...
ANSWER
Answered 2017-Mar-02 at 20:35Judging from your setup, you'll wind up with ...
wss://localhost:8443/myContext/ws/communication/5/kbui/None
Your contextPath
isn't /context
, its actually /myContext
in your setup.
You trimmed out the Servlet Mappings section on the dump (that was the important part. heh)
But attempting to manually add the WSCommunication
Endpoint contained in WebAppContext
from outside of the WebAppClassloader
or the WebApp's ServletContext is probably going to be a problem as well.
You have 3 options:
The JSR356 Automatic Way
Setup bytecode scanning and annotation discovery for your
WebAppContext
and let the startup discover and auto-load theWSCommunication
endpoint.Add the following to your
webContext
...
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install JSR-356
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page