express.io icon indicating copy to clipboard operation
express.io copied to clipboard

Update to latest socket.io

Open IngwiePhoenix opened this issue 10 years ago • 13 comments

I just found this project via npmjs and I totally love the concept of it and want to use it in my app. However, I have an issue...and that is, the outdated socket.io dependency. You require 0.9.x, but 1.3.x is the current. Is it possible to update master?

IngwiePhoenix avatar Mar 21 '15 13:03 IngwiePhoenix

I can't agree more. Looking forward the next change.

xinyuwang avatar Mar 21 '15 13:03 xinyuwang

I had to revert my app back to separated socket.io and express since I need to use 1.3.x. But I’m totally looking forward to an updated version that will have the newer versions in!

BTW I tested what happens if I just kinda update all dependencies and try to run a demo:

[email protected] ~/W/e/e/http-io $ node app

/Users/Ingwie/Work/express.io/compiled/index.js:106
    this.io.configure((function(_this) {
            ^
TypeError: Object #<Server> has no method 'configure'
    at EventEmitter.express.application.io (/Users/Ingwie/Work/express.io/compiled/index.js:106:13)
    at Object.<anonymous> (/Users/Ingwie/Work/express.io/examples/http-io/app.js:2:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

IngwiePhoenix avatar Mar 21 '15 14:03 IngwiePhoenix

There was quite a bit of cleanup between 0.9.x and 1.3.x of socket.io. There's a migration guide, if anyone has time to submit a Pull Request to fix the breaks. It doesn't look too painful, but I just don't have time to try it out right now.

geekytime avatar Mar 30 '15 15:03 geekytime

That actually seems do-able… If it is a 0.9 to 1.3 guide in particular, then I could do that because I do have a lot of time at hand - and I would really like to use this project! :) So I’ll see if I can make that happen...

Am 30.03.2015 um 17:45 schrieb Chris Jaynes [email protected]:

There was quite a bit of cleanup between 0.9.x and 1.3.x of socket.io. There's a migration guide http://socket.io/docs/migrating-from-0-9/, if anyone has time to submit a Pull Request to fix the breaks. It doesn't look too painful, but I just don't have time to try it out right now.

— Reply to this email directly or view it on GitHub https://github.com/techpines/express.io/issues/119#issuecomment-87728428.

IngwiePhoenix avatar Mar 30 '15 19:03 IngwiePhoenix

Since I posted that link, I have spent some time exploring the various options out there for WebSockets. Primus, which calls itself "an abstraction layer for real-time", explains pretty well why they stuck with socket.io 0.9.x.

Note: Primus will never support Socket.IO 1.0. As it's just an abstraction build upon Engine.IO so it makes more sense to use Engine.IO in Primus directly. Socket.IO 0.9.x will be supported as it uses a completely different transport system.

I realize that express.io is coming from a very different angle than Primus, but it does make me wonder if the decision to stick with socket.io 0.9.x might have been based on similar arguments...

geekytime avatar Mar 30 '15 19:03 geekytime

I have some time now...and due to a refactor of my project I will sit down and work this out now - because this project will very simply reduce the compecity of my code.

With refactor, I mean moving my code from being a single-process monster to becoming a multi-process thing. The structure is that there are multiple workers of multiple kinds. for isntance, my local maschine would spawn 8 front-end workers (serving files), 2 workers especially for the chat - that runs via socket.io - and more. But all of them go out on the same http port and such...so it will just be a ton easier if using this project.

So yeah, to the fork button I go!

IngwiePhoenix avatar Apr 11 '15 05:04 IngwiePhoenix

...and then I learn this thing is coffeescripted. I am doomed :P I can see what needs to be changed thanks to the link for the migration guide BUT coding in a "new" language is gonna be a thing...

IngwiePhoenix avatar Apr 11 '15 05:04 IngwiePhoenix

    @_router.stack.push layer

Layer._router does not exist...and now I dont know where to put this. Everything else so far works. But appearently, not being able to register the Layer is an issue...?

IngwiePhoenix avatar Apr 11 '15 06:04 IngwiePhoenix

Okay okay, I got that down. However, I am now stuck at a pretty problem that I know how to solve in JS, at least I think so, but not in Coffee...

So, I re-wrote this layer function into a typical callback and now I want to overwrite express.application.defaultConfiguration to call this.use(...) with the correct context. But... how exactly do I get this right?

defaultConfiguration = express.application.defaultConfiguration
express.application.defaultConfiguration = ->
    defaultConfiguration.apply this
    @use eioInitialize

eioInitialize is the router that initializes request.io. I want to add this middleware upon initialization. Any idea how to solve this?

IngwiePhoenix avatar Apr 11 '15 06:04 IngwiePhoenix

If someone can give me a hint to fix this, let me know please! :)

IngwiePhoenix avatar Apr 11 '15 07:04 IngwiePhoenix

Sorry, I don't usually do shameless self-promotion - but I forked express.io a few months ago here. It supports the latest versions of both socket.io and express. I also rewrote it in plain JavaScript, and changed the API (documented in the readme).

sibartlett avatar Apr 17 '15 00:04 sibartlett

I dont see why this would be shameless? :) It’s very nice to see you re-writing it in pure JS - it really helps a lot! CoffeeScript is just not my language…and I am very sure I am done trying to deal with it :) Will check out the fork and see how well it turns out - thanks for letting us know about it!

On Fr. Apr. 17 2015 02:18:51 Simon Bartlett wrote:

Sorry, I don't usually do shameless self-promotion - but I forked express.io a few months ago here https://github.com/sibartlett/express.oi. It supports the latest versions of both socket.io and express. I also rewrote it in plain JavaScript, and changed the API (documented in the readme).

— Reply to this email directly or view it on GitHub https://github.com/techpines/express.io/issues/119#issuecomment-93866701.

IngwiePhoenix avatar Apr 17 '15 00:04 IngwiePhoenix

+1

zbyte64 avatar Apr 22 '15 21:04 zbyte64