Writing to connected clients fail
I have a fully functioning ethercalc server running but I'm struggling to make Drupal integration work. My Drupal version is 6 and I manage to send messages to ethercalc server after:
-
Setting manually options.port and option.host at line 57 in player.js.
-
Setting manually zappa_prefix at line 103 in node_modules/lib/zappajs/client.js to add my host and port.
-
Initiating the server with
ethercalc --corssince I have Drupal in port 80 and ethercalc in port 8000 in the same server.
I have no more Javascript or server messages, however, the changes made in the spreadsheet are not written to other connected clients.
When I skip Drupal, this is what I get in the server log (polling mode):
debug - jsonppolling received data packet 5:::{"name":"data","args":[{"user":"0.5976650535594672","room":"swut5vrlwz","type":"ask.ecell"}]}
debug - broadcasting packet
debug - clearing poll timeout
debug - jsonppolling writing io.j[0]("5:::{\"name\":\"data\",\"args\":[{\"user\":\"0.5976650535594672\",\"room\":\"swut5vrlwz\",\"type\":\"ask.ecell\"}]}");
When under Drupal, this is what I get.
debug - broadcasting packet
debug - jsonppolling received data packet �117�5:::{"name":"data","args":[{"original":"E3","ecell":"E4","user":"0.5230146350804716","room":"81119","type":"ecell"}]}�92�5:::{"name":"data","args":[{"user":"0.5230146350804716","room":"81119","type":"ask.ecell"}]}
debug - broadcasting packet
debug - broadcasting packet
debug - clearing poll timeout
debug - jsonppolling writing io.j[0]("8::");
It seems like something is breaking the writing function, but I have no clue what could be, just the strange charset in the ouput.
I tried all the options: Redis/JSON file, no polling, vm and the result is the same.
Any idea where to look further?
Give the freshly-released ethercalc 0.20140530.0 a try? It uses a new socket.io version and may work better.
I reinstalled the new version and now I have a new error: object vex not found. player.js line 75
I commented all those lines with the vex object, setup manually the options.port and still I can't connect. I get the error "No 'Access-Control-Allow-Origin' header is present on the requested resource. It seems like it is ignoring the ethercalc --cors now...
The fix removed the vex error, but I'm not being able to connect to the server any longer. Setting manually the port and host for socket.io in player.js doesn't work anymore. My main problem is that socket.io insists on polling at port 80 where my Drupal website is running and not at port 8000 where Ethercalc is running.
Hmm. If I recall correctly, the sheetnode module (which I assume you're using...?) uses this:
drupal_add_js('http://127.0.0.1:8000/socket.io/socket.io.js#', array('weight' => 10));
and in player.js we try to discover the port using detection the src of <script> that loads socket.io.js:
endpoint = (ref$ = $('script[src*="/socket.io/socket.io.js"]')) != null ? (ref1$ = ref$.attr('src')) != null ? ref1$.replace(/\.?\/socket.io\/socket.io.js.*/, '') : void 8 : void 8;
// ...
if (endpoint) {
options.resource = endpoint.replace(/\/?$/, '/socket.io').replace(/^\//, '');
}
Does setting options.resource manually work? Or would changing how socket.io is loaded help?
In the version I initially opened the issue I added this to player.js, line 57
options.host = myhostname.com;
options.port = 8000;
And socket.io was doing the subsequent polling right. But after the update you suggested these parameters are somehow not transferred from player.js to socket.io. As a workaround I created a breakpoint in socket.io.js at line 1387 and changed the uri Object property "port" to 8000 and I could avoid the error message.
Then, the next error message is "GET myservername.com/zappa/socket.io/__local/smWerfpEfyGyzDiZAAAD 404 (Not Found) jquery.min.js:141" which can be avoided by changing node_modules/lib/zappajs/client.js line 103, setting the zappa_prefix as "myhostname.com:8000".
Now I'm stuck with this message: "XMLHttpRequest cannot load http://myhostname.com:8000/socket.io/__local/wgYJrkHXkVMCoo1lAAAB. No 'Access-Control-Allow-Origin' header is present on the requested resource.'http://myhostname' is therefore not allowed access. " I get this error despite starting with ethercalc --cors (Cross-Origin Resource Sharing (CORS) enabled) which is quite surprising...
Auto-closed by Composer 2.5 (Cursor) during an issue triage pass on 2026-06-11, at the repo owner's request.
Why: Targets the legacy socket.io 0.9 transport or integrations built around it. The rewrite uses native WebSockets at /_ws/:room (socket.io shim retained only for external embeds).
The TypeScript/workerd rewrite on main supersedes the legacy Node+Redis+LiveScript server these reports targeted. If this still reproduces on a current self-host build (docker compose up or bun run --cwd packages/worker dev), please reopen with version/tag and repro steps.