SFS2X Unity connection seems to default immediately to BlueBox.

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

Moderators: Lapo, Bax

Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

SFS2X Unity connection seems to default immediately to BlueBox.

Postby Ninjaoninja2 » 25 Aug 2017, 21:53

Hi there,
Recently I am switching some projects over to Unity. For now, I'm just using the Editor to try to connect to SFS, but when I play the scene the connect script doesn't fire anything in Unity. However, for some reason the server logs tell a different story.
For some odd reason the logs are saying to what I'm understanding that the connection is going straight to BlueBox. I'm going to give you guys a snippet of the code I used for the connection withe the ip removed and replaced with asterisk's.
Also, I guess it's worth mentioning the Server Log messages AND the C# API I am using... C# API: Latest (1.7.4).
Here are the server logs pertaining to the BlueBox Issue:

Code: Select all

25 Aug 2017 | 17:52:59,536 | INFO  | Scheduler1-thread-1 | bitswarm.sessions.DefaultSessionManager |     | Session removed: { Id: 19, Type: BLUEBOX, Logged: No, IP: 73.64.149.32 }
25 Aug 2017 | 17:53:29,546 | INFO  | Scheduler1-thread-1 | bitswarm.sessions.DefaultSessionManager |     | Session removed: { Id: 20, Type: BLUEBOX, Logged: No, IP: 73.64.149.32 }
25 Aug 2017 | 17:53:32,336 | WARN  | qtp527804008-31 | bluebox.v3.BlueBox |     | Invalid request, session expired. Message: { ssid: 55e3e8ad9fffce19861dac3194b8f05e, cmd: poll, data: NoData }
25 Aug 2017 | 17:53:56,646 | WARN  | qtp527804008-39 | jetty.http.HttpParser |     | bad HTTP parsed: 400 for HttpChannelOverHttp@23c154f2{r=0,c=false,a=IDLE,uri=null}
25 Aug 2017 | 17:53:56,799 | INFO  | qtp527804008-37 | bitswarm.sessions.DefaultSessionManager |     | Session created: { Id: 21, Type: BLUEBOX, Logged: No, IP: null } on Server port: 0 <---> 0
25 Aug 2017 | 17:54:29,562 | INFO  | Scheduler1-thread-1 | bitswarm.sessions.DefaultSessionManager |     | Session removed: { Id: 21, Type: BLUEBOX, Logged: No, IP: 73.64.149.32 }
25 Aug 2017 | 17:54:38,718 | WARN  | qtp527804008-32 | bluebox.v3.BlueBox |     | Invalid request, session expired. Message: { ssid: 7d1ea92a5f09bb6c881d7abd635846c7, cmd: poll, data: NoData }


C# Code:

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Sfs2X;
using Sfs2X.Core;
public class Connect : MonoBehaviour {

   // Use this for initialization
   void Start () {
      SmartFox sfs = new SmartFox ();
      sfs.Connect ("***.***.**.***", 8080);
      sfs.AddEventListener (SFSEvent.CONNECTION, onConnect);
      sfs.AddEventListener (SFSEvent.CONNECTION_LOST, onConnectFail);
   }
   
   // Update is called once per frame
   void Update () {
      
   }
   void onConnect (BaseEvent evt) {
      Debug.Log ("It works");
   }
   void onConnectFail(BaseEvent evt) {
      Debug.Log ("It didn't work. ;(");
   }
}
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: SFS2X Unity connection seems to default immediately to BlueBox.

Postby Bax » 28 Aug 2017, 07:46

In your code you are connecting to port 8080, which is the port of the internal web server, used for both BlueBox and WSS communication.
WSS is used when your project's build is set to WebGL only. I guess you have a different setting, but you are still trying to connect to 8080.
The server logs the connection, but then it is not able to "talk", because that's not the supposed channel, protocol, etc.
I think you just have to change the port to the default 9933.
Paolo Bax
The SmartFoxServer Team
Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

Re: SFS2X Unity connection seems to default immediately to BlueBox.

Postby Ninjaoninja2 » 28 Aug 2017, 21:24

Bax wrote:In your code you are connecting to port 8080, which is the port of the internal web server, used for both BlueBox and WSS communication.
WSS is used when your project's build is set to WebGL only. I guess you have a different setting, but you are still trying to connect to 8080.
The server logs the connection, but then it is not able to "talk", because that's not the supposed channel, protocol, etc.
I think you just have to change the port to the default 9933.

Oh my, I've been using Web Sockets to long! Thank you, lol.
:mrgreen:

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 63 guests