users@websocket-spec.java.net

[jsr356-users] Re: [jsr356-experts] Simplified MessageHandler configurations

From: <ghsutanu_at_gmail.com>
Date: Tue, 27 Nov 2012 15:49:06 +0000 (GMT)

What is the usecase for having different MessageHandler objects for
different message/frame types ?

IMO, it would have been much simpler if the MessageHandler interface is
the unified handler for all types of websocket messages.

interface MessageHandler {

    void onMessage(String textMessage);

    void onMessage(ByteBuffer binaryMessage)

   void onMessage(String textFrame,
               boolean last)

   void onMessage(String binaryFrame,
               boolean last)

   etc...
}

In this model, there will be a single MessageHandler per websocket
(Session).