Hello, is it possible to deploy a mini socket.io app and use it at the endpoint in runkit? I couldn’t manage it in runkit till now (when I use the successful codes which I use on my desktop).
(The error is: “ReferenceError: io is not defined”)
Thanks…
Could you provide some of the code? It would help us debug your issue.
Thanks,
Francisco
Here is a sample code: https://runkit.com/gursu/deneme-9-socket-io
And its endpoint is here: https://deneme-9-socket-io-dzkomegk3b1b.runkit.sh/
When I use it on my desktop (localhost), I see an “Object { hello: “world” }” in my console (browser) and a “{ my: ‘data’ }” response to it on my node.js prompt. However, at the endpoint in runkit, I see some error messages.
Hi Clojure,
I’ve made a little progress, but the fix is somewhat complex and might take us a little bit unfortunately. If you add the following code at the top of your handler function you will get a little further;
function handler(req,res){
if (req.url === "/socket.io/socket.io.js" ||
req.url === "/socket.io/socket.io.js.map")
return io.serve(req, res);
This will make it so the socket.io script is at least loaded in the page, but I can’t get the connection event to fire yet (I see requests going back and forth though). Either way, perhaps this helps you get a little farther, and we’ll try a few more workarounds too to see if we can get you using this sooner than when our real fix is implemented.
So, just to conclude: this is definitely our bug, I have a vague idea of how to fix it, but it will take a little time so hopefully we can find a workaround in the meantime to get you going (or perhaps give you enough info to help you find a workaround). Really sorry for this, we definitely want to fix it!
Thank you very much for your reply. I look forward to see the bug fixed, good luck!