socket.io!


#1

Created a node package includer for Fuse, used it on socket.io-client and successfully connected to the chat, using socket.io-client’s xhr polling.

https://github.com/bolav/fuse-example-using-socketio


#2

Thank you for your example, I’ve set it up and it’s working.

I’ve cloned your repo https://github.com/bolav/fuse-example-using-socketio

Created local chat server like here: https://github.com/rauchg/chat-example but updated socket.io in package.json to 1.4.5 as the same version is used in Fuse example

But in Fuse console I see a lot of messages like this

Timer.delete(): The parameter is not a valid timer handle

When I click “Locate” link in Fuse console (related to error), I’m thrown to $.uno file in Sublime

		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(): The parameter is not a valid timer handle", this);
			}

			return null;
		}

Is this dangerous? Should I worry about that?


#3

Have you tested socket.io on real iOS device? is it working. Because I can’t even see “connected” message from socket. It works fine in fuse preview but not in fuse preview -t=iOS


#4

poul.kg@gmail.com wrote:

Thank you for your example, I’ve set it up and it’s working.

I’ve cloned your repo https://github.com/bolav/fuse-example-using-socketio

Created local chat server like here: https://github.com/rauchg/chat-example but updated socket.io in package.json to 1.4.5 as the same version is used in Fuse example

But in Fuse console I see a lot of messages like this

Timer.delete(): The parameter is not a valid timer handle

When I click “Locate” link in Fuse console (related to error), I’m thrown to $.uno file in Sublime

		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(): The parameter is not a valid timer handle", this);
			}

			return null;
		}

Is this dangerous? Should I worry about that?

Hi Poul,

I am using different approach and facing same problem with same error Timer.Delete.
Fuse version is latest 1.2.
Did you solve this problem on your app?


#5

solomun.marko
I still have these errors, I just ignore them as my socket connection is working fine.

I wasn’t able to use sockets on my phone because of another issue, my socket URL was entered as localhost, and hence I wasn’t able to connect, as there is no socket server on my phone. When I changed URL to public URL of the socket server, everythin started to work fine. But those errors are still there.


#6

Hi Poul, thanks for reply. Does it crash when you preview on the phone?
My app is crashing the same moment when I try to connect to socket. (At that same time the error is thrown). On PC emulator works fine.


#7

solomun.marko@gmail.com wrote:

Hi Poul, thanks for reply. Does it crash when you preview on the phone?
My app is crashing the same moment when I try to connect to socket. (At that same time the error is thrown). On PC emulator works fine.

In my case it works fine in iOS and Android.


#8

Thanks. Strange and I can not find a way to sort it out. It crash at the same moment when it loads socket.io js file and fires Timer.delete() diagnostics message.
I guess it is related to socket library and how it handles Timers (infinite … maybe). I do not know really and I can not move forward till I find a solution for this.

Thanks anyway.


#9

solomun.marko@gmail.com wrote:

Thanks. Strange and I can not find a way to sort it out. It crash at the same moment when it loads socket.io js file and fires Timer.delete() diagnostics message.
I guess it is related to socket library and how it handles Timers (infinite … maybe). I do not know really and I can not move forward till I find a solution for this.

Thanks anyway.

Which version of socket.io you’re using? I’m using the same version as Bjørn-Olav Strand in his repo, which is 1.4.5


#10

Hi,
I am using latest v2.0, pulled from sockets.io website.


#11

Hi there,

I did tried version 1.4.5 and many other versions from 1.4.0 up to 1.7.0. When I manage to make it work on emulator, than I try to install and run (preview) on my phone OnePlus 3T and tablet Mi Pad 3, I get same results. Crashing. If I could only disable this error reporting in fuse…

I am trying to solve this, cause I can not move any further without sockets.
Please if anyone have any (experimental) idea, let me know and I’ll try :).

Thanks


#12

Also figured out when ever I use this, app starts crashing. I do not even have to call myvar.connect.

var myvar = include('socket.io'); 

Same thing is for any js include.
I have no idea what is going on.


#13

To provide any support, we need to get three things:

  1. A complete, minimal reproduction that consistently crashes. Since this won’t be a single-UX-file app, you can either put it on github or share a complete project with us via dropbox.
  2. An extensive description of the conditions the crashes occur in (computer OS, preview/export of the app, mobile target OS, versions of other involved things etc.).
  3. The crash logs themselves (run the app in XCode / Android Studio, enable breakpoints and debug a little).

We’ll see what we can do to help.


#14

Hi Uldis,
Thanks for reply. Project files are uploaded. I am using:

  • Fuse 1.2.1,
  • Windows 10 Pro x64.
  • Android phone with 7.1.1
  • Android tablet with 7.0

Latest Java installed. I have tried several different (finished) apps samples with socket.io file included and got same problems. I did also try (cloned) https://github.com/bolav/fuse-example-using-socketio project which also does work in preview but crashing on the phone. When I exclude socket.io from UX, app does not crash.
Server side is:

var server = require('http').createServer();
var io = require('socket.io')(server);
var receivedMsg = "";
console.log('Server started. Listening on port: 3233');
io.sockets.on('connection', function (socket) {
    console.log('socket connected');

    socket.on('disconnect', function () {
        console.log('socket disconnected');
    });

    socket.emit('text', 'Server msg responds');

    socket.on('clientWelcome', function (clientWelcome) {
        console.log('New client connected with message');
        console.log('Message received: ' + clientWelcome);

        socket.emit('text', 'Thx, message received. : ' + clientWelcome);

    });


});

server.listen(3233);

Log:

08-21 23:04:57.539 28220 28220 I Google Maps Android API: Google Play services client version: 9256000
08-21 23:04:57.548 28220 28220 I Google Maps Android API: Google Play services package version: 11302440
08-21 23:04:58.195 28220 28220 W afz     : copyMemory is missing from platform - proto runtime falling back to safer methods.
08-21 23:04:58.610 28220 28220 I Choreographer: Skipped 189 frames!  The application may be doing too much work on its main thread.
08-21 23:04:58.668 28220 28275 I DpmTcmClient: RegisterTcmMonitor from: com.android.okhttp.TcmIdleTimerMonitor
08-21 23:04:58.681 28220 28275 D NetworkSecurityConfig: No Network Security Config specified, using platform default
08-21 23:04:58.954 28220 28271 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7 in tid 28271 (Thread-2)
08-21 23:04:58.955   462   462 W         : debuggerd: handling request: pid=28220 uid=10355 gid=10355 tid=28271
08-21 23:04:59.028 28334 28334 F DEBUG   : pid: 28220, tid: 28271, name: Thread-2  >>> com.friends.android <<<
08-21 23:05:00.131 28220 28220 I Choreographer: Skipped 70 frames!  The application may be doing too much work on its main thread.
08-21 23:05:00.143   462   462 W         : debuggerd: resuming target 28220
08-21 23:05:00.143 28340 28340 W ls      : type=1400 audit(0.0:16682): avc: denied { getattr } for path="/proc/28220" dev="proc" ino=10915064 scontext=u:r:core_dump:s0 tcontext=u:r:untrusted_app:s0:c512,c768 tclass=dir permissive=0
08-21 23:05:00.288  1441  6748 I ActivityManager: Process com.friends.android (pid 28220) has died
08-21 23:05:00.288  1441  6748 D ActivityManager: cleanUpApplicationRecord -- 28220
Process com.friends.android terminated.

I did not try on Mac. I’ll have to boot up VM and setup all I need.

Thanks guys!


#15

Anyone? - I am still looking for solution and what ever I try it does not work.
There are several other projects since fuse 0.20 but they are not working at all because there are a lot of changes made since then. This drives me mad and forces me to go back to Cordova. I am just “not getting it”.


#16

@solomun.marko:

We’ve done some debugging on this, and so far there’s a ticket about the websockets issue, and another one which is the actual root cause of the crash in this particular case.

Both of those tickets are linked to this forum post, and we’ll definitely let you know as soon as there is some progress.


#17

Hi Uldis,
Thanks for quick reply. I am really happy to hear that. I’ll stay tuned and track that tickets for updates.
Thanks again!
M.


#18

Here is a fixed socket.io for better fuse compatibility - https://gist.github.com/igorls/5009b33230bb635590bebf364f14cc45

The solution is pretty easy to implement on their side… actually on the engine.io library

I will suggest those changes there, I believe they were considering there is no problem on calling clearTimeout with null argument on a browser, but I don’t think this is the best practice


#19

Fantastic work @igor.linsesilva!

Sure hope to see your fix merged into their library eventually. In the mean time, we still have our own tickets to work around the core issue in Fuse.


#20

@igor great job man. As Uldis said, it has to be implemented/fixed on fuse side. Until then, I’ll try this.
Thanks man!