Comments (7)
- Issue Imported From: https://github.com/javaee/websocket-spec/issues/47
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @pavelbucek
- Original Issue Closed By:@glassfishrobot
from websocket.
@glassfishrobot Commented
Reported by dannycoward
from websocket.
@glassfishrobot Commented
dannycoward said:
Here's my current thinking, which we will discuss in the expert group.
MessageHandlers and Decoders
Principles
Each message is handled by at most one message handler
Messages that are unhandled result in calls to onError/@WebSocketError callbacks so developers always know if incoming messages are not handled
Developer provided decoders are chosen before platform decoders.
If a decoder fails, the error is delivered and no more decoders are attempted.
Process
1. a whole string message arrives
a) if there is an MessageHandler.AsyncText handler - do not call it
b) if there is an MessageHandler.CharStream handler - do not call it
c) if there is a MessageHandler.Text handler handler, call it and stop, using the first developer provided Decoder.TextStream or Decoder.Text, if any.
d) if there is a MessageHandler.DecodedObject
then try to find a Decoder.Text or a Decoder.TextStream. Look, in order, through developer provided ones (single list, may contain both Text and TextStream types). Then look through platform provided ones. Use the first match to decode it. If the decode works, call the MessageHandler and stop, if not, call the onError/@websocket method with the decode exception and stop. If no decoder is found, the message is unhandled.
Option: prefer higher level objects to lower level ones. i.e. if there is a decoder for T, and there is a MessageHandler.DecodedObject, and also a MessageHandler.Text, choose the MessageHandler.DecodedObject.
e) If the message is unhandled, call back on the onError/@WebSocketError method. We may need a new exception type for Unhandledmessages.
- a whole binary message arrives: same process as 1).
3 the first piece of a chunked string message arrives.
a) if there is an MessageHandler.AsyncText handler - call it repeatedly until all the message has arrived and stop
b) if there is an MessageHandler.CharStream handler - call it with a Reader linked to the incoming parts, and stop
c) if there are MessageHandler.Text or MessageHandler.DecodedObject handlers, wait for all the string pieces to arrive, building the whole message as you go (subject to the buffer limit defined on the API). If the buffer limit is exceeded call the onError/@WebSocketError method on the endpoint. Otherwise, using the whole message, jump to the analogous steps for 1c), d) and e).
- the first piece of a chinked binary message arrives
same process as 3) but for binary.
from websocket.
@glassfishrobot Commented
dannycoward said:
This has now been fixed.
from websocket.
@glassfishrobot Commented
Was assigned to dannycoward
from websocket.
@glassfishrobot Commented
This issue was imported from java.net JIRA WEBSOCKET_SPEC-47
from websocket.
@glassfishrobot Commented
Marked as fixed on Friday, November 2nd 2012, 5:34:16 pm
from websocket.
Related Issues (20)
- Ballot for WebSocket 2.0 is approved, please perform the actions listed here HOT 1
- Jakarta Websocket webpage contains outdated information for latest download HOT 1
- Provide an API to ContainerProvider to allow ServiceLoader results to be filtered / prioritised / sorted HOT 15
- Not able to get ping and pong message from server to go lang websocket client HOT 4
- Java websocket server sending the ping message but go lang webscket client not received the ping message HOT 4
- Session idle timeout doesn't define behaviour for 0 or negative values HOT 1
- Remove GNU license HOT 5
- Move this repo to https://github.com/jakartaee HOT 2
- Compatibility Certification Request for Eclipse Tyrus 2.1.0-M3 HOT 2
- Problem with @ClientEndpoint HOT 3
- Finalize Jakarta Websocket 2.1.0 Release HOT 2
- ContainerProvider factory method should be security manager sensitive HOT 2
- The WebSocket.adoc chpater A.3 Pull Request 315 link wrong url HOT 1
- why is websocket no support for cluster? HOT 2
- Should jakarta.websocket.ClientEndPoint.Configurator.afterResponse(HandshakeResponse hr) be called even on failed upgrade? HOT 1
- Certification Request: Tomcat-11.0.0-M19-SNAPSHOT for WebSocket 2.2.0 HOT 6
- Compatibility Certification Request for Eclipse Tyrus 2.2.0-M1 (JDK 21) HOT 2
- Compatibility Certification Request for Eclipse Tyrus 2.2.0-M1 (JDK 17) HOT 1
- Compatibility Certification Request for Tomcat 11.0.0-M20 HOT 1
- Finalize the Jakarta Websocket 2.2 Release HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websocket.