WrathChaos/StompClientLib

Login, passcode

igormagurean opened this issue · 6 comments

How can I set connection like that?
Where should I enter login and passcode? My delegate methods are not called, getting output frames failed, state 8196
Also I have wss://xxx.com:61024/
Please help.

Screen Shot 2019-05-20 at 19 14 52

Hello @blinkmeoff,
Why are you trying to use a websocket just for login ?
Is there a must logic behind it?

You can use socket.send() method however I do not recommend that because you need to handle everything for yourself. Therefore, you do not need this library if you want to do that, you can simply use Facebook's Websocket and handle it on your own:

STOMP 1.2 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.

STOMP 1.2 clients MAY set the following headers:

login : The user identifier used to authenticate against a secured STOMP server.
passcode : The password used to authenticate against a secured STOMP server.
heart-beat : The Heart-beating settings.

At the end @blinkmeoff's business logic is fixed and it works :)
Closed <3

My problem was that I was sending "login,passcode,accept-version" in header, this is wrong, to CONNECT via STOMP it's a simple String.

let connectFrame = "CONNECT\n
                                   login:admin\n
                                   passcode:password\n\n\n\0"

```We just need to write socket.write(string: connectFrame)

using username and password for login purposes is an essential feature. It would enhance the usefulness of this library much if it were documented somewhere. Not everyone will do a comprehensive search of open and closed issues just to find this feature.

I will add an example on the README :) Thank you for the suggestion @michaelpeternell