NaikSoftware / StompProtocolAndroid

STOMP protocol via WebSocket for Android
MIT License
591 stars 265 forks source link

STOMP 1.1 'accept-version' and 'host' CONNECT headers in StompClient class #131

Open UbivisDev opened 5 years ago

UbivisDev commented 5 years ago

Is there a reason for not implementing the headers 'accept-version' and 'host' as default for the CONNECT frame in StompClient class? Those are required by the protocol as stated here, as the following:

STOMP 1.1 clients MUST set the following headers: accept-version : The versions of the STOMP protocol the client supports. See Protocol Negotiation for more details. host : The name of a virtual host that the client wishes to connect to. It is recommended clients set this to the host name that the socket was established against, or to any name of their choosing. If this header does not match a known virtual host, servers supporting virtual hosting MAY select a default virtual host or reject the connection.

houshunwei commented 5 years ago

you need change the source code: in ua.naiksoftware.stomp.StompHeader class public static final String VERSION = "version"; which should be: public static final String VERSION = "accept-version";

UbivisDev commented 5 years ago

I'm aware of the requirements for it to work. My question is, why is it not standard for the library, as it says it complies with the 1.1 definition? Is there a reason or not? Because if there isn't, I would advocate to include those headers. The 'version' headers isn't even meant to be used by the client as payload in sent messages, it is reserved for the server, unless I'm missing something.

NaikSoftware commented 5 years ago

Yes, you are right. This is my innatention.

NaikSoftware commented 5 years ago

Stop, StompHeader.VERSION contains "accept-version" string.