Websocket request rejected

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

ducbot
Posts: 6
Joined: 23 Apr 2018, 09:16

Websocket request rejected

Postby ducbot » 17 May 2018, 18:02

Hi SmartFoxServer Support Team,

I'm trying to connect to my server via WSS from WebGL, I added the certification successfully.

However, the connection has been rejected as the below content:

Websocket request rejected. Received: TEXT, Required: Byte[], Session will be closed.

What's the root cause of rejected reason ?

Thank you.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Websocket request rejected

Postby Lapo » 18 May 2018, 07:09

HI,
it looks like you're using the wrong protocol.
The server is expecting a binary protocol but the client is sending text.

You can either switch the configuration on the server side (to force Text) or pass a parameter in the constructor of the API to use the binary protocol. Unless you're using an older version of the API we recommend using the binary protocol.

See here:
http://docs2x.smartfoxserver.com/api-do ... 8515dc.htm

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
ducbot
Posts: 6
Joined: 23 Apr 2018, 09:16

Re: Websocket request rejected

Postby ducbot » 18 May 2018, 15:57

Thank you Lapo.

My issue was fixed by changing the UseWebSocket from WSS to WSS_BIN.

Have you ever tried Cloudflare for WSS ?

Thank you so much for your support.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Websocket request rejected

Postby Lapo » 19 May 2018, 14:05

ducbot wrote:Thank you Lapo.

My issue was fixed by changing the UseWebSocket from WSS to WSS_BIN.

Good to hear that
Have you ever tried Cloudflare for WSS ?

I am not sure what you mean by that. Can you elaborate?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
jahanzaibkhan
Posts: 1
Joined: 16 May 2019, 11:07

Re: Websocket request rejected

Postby jahanzaibkhan » 17 May 2019, 05:31

Hi there,

I am also getting the same error, the thing is I m also using UseWebSocket.WS as I have an older version of C# client API (1.7.2) and it doesn't have binary structs (UseWebSocket.WS_BIN) . I have tried to replace it with the latest version(1.7.12) but it seem that it doesn't get fit in to my code as it is giving me an error and doesn't compiles the project. The error message is given below.

The primary reference "SmartFox2X" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.
.

It will be so kind of you if u will help me sort out this problem. Thanks in advance.
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Websocket request rejected

Postby Bax » 17 May 2019, 08:14

jahanzaibkhan wrote:Hi there,

I am also getting the same error, the thing is I m also using UseWebSocket.WS as I have an older version of C# client API (1.7.2) and it doesn't have binary structs (UseWebSocket.WS_BIN) . I have tried to replace it with the latest version(1.7.12) but it seem that it doesn't get fit in to my code as it is giving me an error and doesn't compiles the project. The error message is given below.

The primary reference "SmartFox2X" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.
.

It will be so kind of you if u will help me sort out this problem. Thanks in advance.

In order to use our latest API, you have to change the Scripting Runtime Version in the configuration of your project to ".NET 4.x Equivalent".

Image
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X Questions”

Who is online

Users browsing this forum: DonaldVed and 50 guests