alexwidua / vue-socketio-heroku-starter

🖥️🤝 Socket.io-vue starter ready for deployment to Heroku.
5 stars 2 forks source link

.env #15

Open ehijzengsf opened 3 years ago

ehijzengsf commented 3 years ago

Hi, To make it start I had to add PORT=3000 in de .env.development file.

ehijzengsf commented 3 years ago

Hi, For some reason the get requests are working but de post requests do not work. It causes a 404. Am I missing something?

alexwidua commented 3 years ago

This sample code is not utilizing post or get requests, do you mean socket.io emit events?

ehijzengsf commented 3 years ago

Thanks for responding so quickly! In the following screenshot you the get en posts. This is coming form inspector > network > xhr in firefox. Screenshot 2021-08-30 at 16 24 23

alexwidua commented 3 years ago

Ah, I see. From my experience, this issue has most likely to do with the port. Try setting a different port in the .env file (ex. to 8080 or hard-coding your local machine's IP adress instead of localhost.

A second guess would be to add an explicit IP address in the server.js express http.listen() function, ex. http.listen(3000, '127.0.0.1')

ehijzengsf commented 3 years ago

Thanks I tried: http://127.0.0.1:8080. Same issue http://192.168.19.61:8080. Same issue hard coded: http.listen(8080, '192.168.19.61', () => { console.log ("server started"); })

.env.development: VUE_APP_HOST=192.168.19.61:8080 PORT=8080 HOST=192.168.19.61

This post, is it originated by vue-socket.io-extended@4.0.3? Is that normal behavior or is it simply not supported by socket.io?

alexwidua commented 3 years ago

I see. I took a quick stab at it myself. Updating the dependencies apparently introduced some breaking changes because vue-socket.io-extended was wacky and opened multiple socket connections at once. I'm not sure when I have the time to dig into this, but I've updated the dependencies and switched to vue-socket.io instead of its extended fork.

Give it a whirl and see if it fixes your issue, I'm not sure when I have time to dig deeper into this.