centrifugal / centrifuge-ios

Swift client to communicate with Centrifugo v1 from iOS over WebSocket (not maintained anymore)
MIT License
28 stars 23 forks source link

invalid token for user ios-swift #10

Closed arden closed 7 years ago

arden commented 7 years ago

When i'm run this examples. the server side have some errors is: invalid token for user ios-swift

mogol commented 7 years ago

Hi, could you provide details/logs ? I have just checked examples, everything is OK.

arden commented 7 years ago

@mogol i'm use server as: let url = "ws://localhost:8000/connection/websocket" Optional(Error Domain=com.Centrifuge.error.domain.websocket Code=3000 "{"reason":"invalid token","reconnect":false}" UserInfo={NSLocalizedDescription={"reason":"invalid token","reconnect":false}})

FZambia commented 7 years ago

@arden please also show us how you generate your token and which credentials do you use: user, timestamp and info.

arden commented 7 years ago

i'm deploy a centrifuge server on my localhost, and change the client connect url is: let url = "ws://localhost:8000/connection/websocket" some error is invalid token.

but use let url = "wss://centrifugo.herokuapp.com/connection/websocket" work fine.

i'm only modify the client connect url, that connect my localhost centrifuge server.

FZambia commented 7 years ago

@arden I suppose that ws://localhost:8000/connection/websocket and wss://centrifugo.herokuapp.com/connection/websocket use different secret keys. wss://centrifugo.herokuapp.com/connection/websocket uses secret as secret key. Looks like in your local instance you have another secret key set in config (or maybe you have not set it in config.json at all)

arden commented 7 years ago

@FZambia thanks, work fine now.

arden commented 7 years ago

@FZambia @mogol now,i'm develop a game APP, there are two way: socket.io or centrifuge。Which of them is better.

FZambia commented 7 years ago

@arden sorry, it's only up to you to decide which solution is better for your case 😏