Open matthewp opened 7 years ago
is this the bug https://github.com/feathersjs/feathers-socketio/issues/81
they say zones can't handle socket.io in general.
Yep, this is true.
as far as i understand For can-zone to work we have to override various task-creating functionality, this is the list of what we currently implement:
Macrotasks
setTimeout XMLHttpRequest Microtasks
requestAnimationFrame Promise process.nextTick
we need to implament socket.io here or i use a promis based socket io lib?
I think the socket.io issue is because they do a recursive setTimeout. Without some heuristic to detect this I'm not sure that's fixable.
Yes, using Zone.ignore
will ignore any async tasks that are called within.
rendering head and body stache directly to html and disable done-autorender
Use done-autorender without zones
use ignore Prototype from can-zone The issue is Zone related. The reason it is not rendering is because the Zone never completes and done-autorender waits for the Zone to complete. You can use Zone.ignore to ignore functions:
var Zone = require("can-zone");
var someFunctionThatCallsSetInterval = require("dep");
var ignored = Zone.ignore(someFunctionThatCallsSetInterval);
// Now you can safely call ignored() ignored()
If some behavior is completed within a websocket message this needs to be wrapped within the Zone.