Sign In Register

How can we help you today?

Start a new topic

Duplicate connections to service upon startup on Android

Hello, lately I have been trying to figure out why on the Android device I always receive double messages from GameSparks (TeamMessage etc.) I found out that whenever I run gamesparks on Android, it will, for some unknown reason, connects to your services twice. I am attaching a debug log where you can notice that after booting your GameSparksTestUI scene the device makes 4 connections to your service : 

Two of them a are on "preview" and two of the are on "gsp-aeu000-se08/09" (which I really do not now what is - can you explain?).


When I run the same scene in editor it will make only 2 connections (but sometimes also 4). Can you explain to me what am I doing wrong and how to prevent these multiple connections? I am running your GameSparksTestUI scene


Here is the log for these 4 connections ( I removed secret keys and device ID, they are same for all 4 connections)



GS: Connecting to:wss://preview-k311217vdgNx.ws.gamesparks.net/ws/device/XXX?deviceOS=ANDROID&deviceID=YYYa&SDK=


GS: Connecting to:wss://preview-k311217vdgNx.ws.gamesparks.net/ws/device/XXX?deviceOS=ANDROID&deviceID=YYYa&SDK=


GS: Connecting to:wss://gsp-aeu000-se08.gamesparks.net/ws/device/XXX?deviceOS=ANDROID&deviceID=YYY&SDK=


GS: Connecting to:wss://gsp-aeu000-se09.gamesparks.net/ws/device/XXX?deviceOS=ANDROID&deviceID=YYY&SDK=


Thanks,

Jan






1 person has this question

Hi Jan,


I've created a ticket for you. We'll continue the conversation there.


Regards,

Liam

Hi,

yes I was on Wifi. So I tried with mobile connection and believe or not...double login is gone! Do you have any idea what could cause problems with wifi connection? Because many people play over wifi on android so they will get double connections. Or is it some strange setup of my Wifi that is causing this?

Jan

Hi Jan,

Previously you said that you are still using Wi-Fi connection on your Android devices, have you already tried the mobile data connection?


Giuseppe

I used SDK Version : 5.6.2.193


Hi jan,


What version of the SDK are you using here ?


Regards,

Liam

Hi, thanks! I did not tested running this stacktrace output on all of them but I know that on all 3 devices I get double connections so I guess the reason for this is same on all devices

Hi Jan,


Apologies for the delayed response. I'll run this by the SDK team. Is this happening on all android device builds or just on this specific one ? 


Regards,

Liam

I tried to digg as deep as I could and this is what I found out:


The original connection is called at Editor and Android from the same, seemingly correct place, some kind of Initialization of your Gamesparks.Core:


at System.Environment.get_StackTrace()

I/Unity   (10730):    at GameSparks.Platforms.DefaultPlatform.GetSocket(System.String url, System.Action`1 messageReceived, System.Action closed, System.Action opened, System.Action`1 error)

I/Unity   (10730):    at GameSparks.Core.GSConnection.EnsureConnected()

I/Unity   (10730):    at GameSparks.Core.GSConnection..ctor(GameSparks.Core.GSInstance gs, IGSPlatform gsPlatform, System.String currentUrl)

I/Unity   (10730):    at GameSparks.Core.GSInstance.Initialise(IGSPlatform platform)

I/Unity   (10730):    at GameSparks.Core.GS.Initialise(IGSPlatform gSPlatform)

I/Unity   (10730):    at GameSparks.Platforms.PlatformBase.Start()



..... but then on Android only(!) something strange happens. The duplicate connections are called probably because your code decides that new connection is required and creates a new one. Not sure what it is as this is in your binary code and I cannot investigate further :(

 at GameSparks.Platforms.DefaultPlatform.GetSocket(System.String url, System.Action`1 messageReceived, System.Action closed, System.Action opened, System.Action`1 error)

I/Unity   (10730):    at GameSparks.Core.GSConnection.EnsureConnected()

I/Unity   (10730):    at GameSparks.Core.GSConnection..ctor(GameSparks.Core.GSInstance gs, IGSPlatform gsPlatform, System.String currentUrl)

I/Unity   (10730):    at GameSparks.Core.GSInstance.NewConnection()

I/Unity   (10730):    at GameSparks.Core.GSInstance.ConnectIfRequired()

I/Unity   (10730):    at GameSparks.Core.GSInstance.ProcessQueues()

I/Unity   (10730):    at GameSparks.Core.GameSparksTimer.TimerCallback(System.Object state, System.Timers.ElapsedEventArgs e)

I/Unity   (10730):    at System.Timers.Timer.Callback(System.Object state)


Any ideas whats going on? Again, this is 100% report, just create blank new project and put your "GameSparksUnity" script into the scene and run on Android, thats all you need to do.

Guys, this is still happening. Absolutely easy to repro. Create blank new project in Unity, import Gamesparks plugin downloaded from your website and run the "GameSparkTestUI" scene on ANDROID. Thats all. I get double connection requests consistently upon application startup on all my Android devices ( I have 3 now)..... If I hit "Disconnect" and then "Reconnect" buttons in the scene itself, it will correctly connect only once as it should..... This is 100% repro on my side. I cannot figure out how to get rid of this duplicate connections other than let the application connects at start and then reconnect it again to lose these double connections and get only one. This is literally the only issue that prevents me to put my game into alpha testing :((

Hi, any new on this issue? Were you able to reproduce it?

1. Device 

Samsung Galaxy Grand prime  (SM-G531F)

Android  5.1.1

2. Device:

Android 4.1.2

Samsung Galaxy S2 (GT-I9100)



Hi Jan,


What android devices and versions of android are you seeing this behavior on ?


Regards,

Liam

I use Wifi on android devices. I use "Build & Run" with device connected to PC over USB cable. I left the default settings, see the images.

settings.jpg
(135 KB)
Are you using Wifi or mobile data connection on your devices? How do you export your project to Android and which settings did you set up?

Giuseppe

 

Hi,

That is strange It is doing 100% time on my 2 Android devices. I have also good Wifi connection. I also tried to create brand new Gamesparks project and connect to it but it is the same. Also notice that these double connections are only occurring only upon startup. When the application is already running and I disconnect and reconnect to service it will correctly connect on once. I am using Unity 2017.1.0f3.

Jan

Login to post a comment