websocket-spec
  1. websocket-spec
  2. WEBSOCKET_SPEC-185

RemoteEndpoint.Async methods could provide better connection back to the Session

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      In with the callback and the Future version of the RemoteEndpoint.Async there is no obvious way to discover what the original Session object was, this makes things a little bit more complicated when you are trying to broadcast to a number of listening clients.

      Ideally the "SendResult" object should have a reference to the original Session that way the SendMessage object could be implemented with once instance rather than one for each Session. This would allow the broadcasting code to be able to check the state of the Session, perhaps dealing with a odd exception by checking to see if the Session is still open / or valid.

      Having to write some kind of if/else code to deal with the Throwable parameter on SendResult also feels a little bit dirty particular as normally we are expecting SessionsException. Could we always get a SessionException instead that might have a more generic cause - this would make life a bit easier. I guess this would also be another way to get hold of the Session consistently.

      It would also be nice for consistency if the Future returned by the polling version of the API instead of returning Future<Void> return Future<SendResult> for consistency. Although obviously the semantics might be different in a failure case - I suppose it could also return Future<Session> but it would be less flexible.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            gdavison
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: