Express.js add socket.io in routes/socketmessage.j

2019-08-17 13:48发布

问题:

I would like to make real-time chat app on React-Native,

I have backend express

like this; enter image description here

Now , I want to use socket.io in express backend , But not in app.js I would like to use socket.io in socketmessage.js

my client side code

this.socket = io(url.getURL()+"/socketmessage",{jsonp:false})

I tried this post but didn't run

Using socket.io with express 4 generator

how can I do this? Thank you...