Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login, passcode #42

Closed
igormagurean opened this issue May 20, 2019 · 6 comments
Closed

Login, passcode #42

igormagurean opened this issue May 20, 2019 · 6 comments
Labels

Comments

@igormagurean
Copy link

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

@WrathChaos
Copy link
Owner

WrathChaos commented May 22, 2019

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:

@igormagurean
Copy link
Author

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.

@WrathChaos
Copy link
Owner

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

@igormagurean
Copy link
Author

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)

@michaelpeternell
Copy link

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.

@WrathChaos
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants