Giter Club home page Giter Club logo

Comments (7)

glassfishrobot avatar glassfishrobot commented on August 22, 2024

from websocket.

glassfishrobot avatar glassfishrobot commented on August 22, 2024

@glassfishrobot Commented
Reported by dannycoward

from websocket.

glassfishrobot avatar glassfishrobot commented on August 22, 2024

@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.

  1. 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).

  1. the first piece of a chinked binary message arrives

same process as 3) but for binary.

from websocket.

glassfishrobot avatar glassfishrobot commented on August 22, 2024

@glassfishrobot Commented
dannycoward said:
This has now been fixed.

from websocket.

glassfishrobot avatar glassfishrobot commented on August 22, 2024

@glassfishrobot Commented
Was assigned to dannycoward

from websocket.

glassfishrobot avatar glassfishrobot commented on August 22, 2024

@glassfishrobot Commented
This issue was imported from java.net JIRA WEBSOCKET_SPEC-47

from websocket.

glassfishrobot avatar glassfishrobot commented on August 22, 2024

@glassfishrobot Commented
Marked as fixed on Friday, November 2nd 2012, 5:34:16 pm

from websocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.