# Socket.io is not working on Android on device 

**URL:** https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887
**Category:** Bug Reports
**Created:** [April 10, 2017, 7:24pm UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887 "2017-04-10T19:24:32Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Mehdi.jarraya](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Mehdi.jarraya](https://forums.fusetools.com/u/Mehdi.jarraya)
#### Post date: [April 10, 2017, 7:24pm UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/1 "2017-04-10T19:24:32Z")

</div>

Socket works perfectly in emulator but not in Android device.  
I’m using Windows 10 x64 and Fuse v 0.36.

---

<div class="post-metadata">

### Author: ![Bent](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/bent/32/157_2.png) [@Bent](https://forums.fusetools.com/u/Bent)
#### Post date: [April 10, 2017, 7:48pm UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/2 "2017-04-10T19:48:39Z")

</div>

Unfortunately it’s impossible to assist you without any information at all about what fails and how. Please provide a more detailed error report, including any relevant logs and screenshots that can help out.

---

<div class="post-metadata">

### Author: ![Mehdi.jarraya](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Mehdi.jarraya](https://forums.fusetools.com/u/Mehdi.jarraya)
#### Post date: [April 11, 2017, 10:41am UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/3 "2017-04-11T10:41:34Z")

</div>

There is no error or logs ,this code works only in emulator .

```auto
var io=require('libs/socket.io-1.4.5.js');
// this line connect socket to server it is not executing on Android devices
var socket=io('URL of node.js Server');

```

I d’ont have a mac i’m using widows 10 x64 but when i tested my code with a mac on an Iphone the socket connect to server and there is no problem .

---

<div class="post-metadata">

### Author: ![Anders\_Bondehagen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_bondehagen/32/98_2.png) [@Anders\_Bondehagen](https://forums.fusetools.com/u/Anders_Bondehagen)
#### Post date: [April 11, 2017, 2:07pm UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/4 "2017-04-11T14:07:03Z")

</div>

You say it’s not executing, what do you mean about that? Does that function call hang. Could you try to wrap it in a try catch to get an error?

---

<div class="post-metadata">

### Author: ![Mehdi.jarraya](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Mehdi.jarraya](https://forums.fusetools.com/u/Mehdi.jarraya)
#### Post date: [April 12, 2017, 3:03am UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/5 "2017-04-12T03:03:29Z")

</div>

There is no error or exception to catch, i also replaced [socket.io](http://socket.io) lib with the newest version, always the same problem socket works only on emulator.

---

<div class="post-metadata">

### Author: ![Mehdi.jarraya](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Mehdi.jarraya](https://forums.fusetools.com/u/Mehdi.jarraya)
#### Post date: [April 14, 2017, 6:05pm UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/6 "2017-04-14T18:05:38Z")

</div>

ps:my nodejs server is hosted, so there is no problem of connection between device and server and when i tested my code with an iphone it works.  
The problem persists only on Android devices.

---

<div class="post-metadata">

### Author: ![Mehdi.jarraya](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Mehdi.jarraya](https://forums.fusetools.com/u/Mehdi.jarraya)
#### Post date: [April 17, 2017, 2:42pm UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/7 "2017-04-17T14:42:41Z")

</div>

This warning appear in loop when i preview in Android.

```auto
LOG: Warning: Timer.delete(): The parameter is not a valid timer handle in Fuse.Reactive.FuseJS.TimerModule<C:\Users\Mehdi\AppData\Local\Fusetools\Packages\Fuse.Reactive.JavaScript\0.47.7\fusejs\$.uno:829>

```

---

<div class="post-metadata">

### Author: ![Anders\_Bondehagen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_bondehagen/32/98_2.png) [@Anders\_Bondehagen](https://forums.fusetools.com/u/Anders_Bondehagen)
#### Post date: [April 18, 2017, 10:49am UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/8 "2017-04-18T10:49:44Z")

</div>

Could you send us your project so we can take a look? You can upload here [https://www.dropbox.com/request/ZgndLtJQm5eGzG9cicGK](https://www.dropbox.com/request/ZgndLtJQm5eGzG9cicGK)

---

<div class="post-metadata">

### Author: ![Mehdi.jarraya](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Mehdi.jarraya](https://forums.fusetools.com/u/Mehdi.jarraya)
#### Post date: [April 19, 2017, 1:01pm UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/9 "2017-04-19T13:01:00Z")

</div>

Thank you a lot, i have found a solution while trying to make a new sample project.  
Server side version must be upgraded (i used “[socket.io](http://socket.io)”: “^1.7.2”).  
This param `{ "forceBase64" : 1}` is required for Android devices.

```auto
var io=require('libs/socket.io-1.4.5.js');
var socket =io.connect('url', { "forceBase64" : 1 });
//or with query 
var socket=io.connect('url', { "forceBase64" : 1 ,query: 'id='+json.user._id } );

```

---

<div class="post-metadata">

### Author: ![solomun.marko](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@solomun.marko](https://forums.fusetools.com/u/solomun.marko)
#### Post date: [August 14, 2017, 10:47pm UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/10 "2017-08-14T22:47:53Z")

</div>

Hi Mehdi,

I am looking for a [socket.io](http://socket.io) implementation into Fuse app. I have things working with Cordova, but not In Fuse.  
I am facing same Timer.delete() errors. Fuse v1.2 and latest [socket.io](http://socket.io) 2.0.x.  
I can run the app in emulator, but preview on the phone is crashing. Base64 did not help. I did not install apk on my device.

Any clue how to solve this? Function `Delete` needs some args for execution (i think) but does not get it or takes too long to execute.

```auto
 object Delete(Fuse.Scripting.Context context, object[] args)
		{
			if (args.Length > 1)
				throw new Error("delete(): requires one argument");

			try
			{
				var handle = Marshal.ToInt(args[0]);
				_tm.DeleteTimer(handle);
			}
			catch (MarshalException me)
			{
				Fuse.Diagnostics.UserWarning("Timer.delete(): NEW ERROR TEXT HERE / TEST", this);
			}

			//return null;
			return 8000;
		}

```

I have changed the error text and return value. I does not make any change. I am still getting old error (Text).

Any ideas? Thanks

---

<div class="post-metadata">

### Author: ![Pasindu\_Dineth\_Peiri](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/pasindu_dineth_peiri/32/55_2.png) [@Pasindu\_Dineth\_Peiri](https://forums.fusetools.com/u/Pasindu_Dineth_Peiri)
#### Post date: [August 29, 2017, 5:06am UTC](https://forums.fusetools.com/t/socket-io-is-not-working-on-android-on-device/3887/11 "2017-08-29T05:06:59Z")

</div>

i have the same error. If someone know how to fix this, please inform me also. thank you.  
this is my forum post…[https://www.fusetools.com/community/forums/howto\_discussions/how\_to\_use\_socket\_io\_with\_fusetools](https://www.fusetools.com/community/forums/howto_discussions/how_to_use_socket_io_with_fusetools)
