Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket IO not reachable from outside docker #5045

Closed
jovobe opened this issue Sep 1, 2016 · 5 comments
Closed

Socket IO not reachable from outside docker #5045

jovobe opened this issue Sep 1, 2016 · 5 comments

Comments

@jovobe
Copy link
Contributor

jovobe commented Sep 1, 2016

Expected Behavior

The web view can connect to the socket.io server provided by the bot. No matter if you are running it in docker container or not.

Actual Behavior

When run in docker container the web view can't connect to the socket.io server from the bot. I already added a ports-section (mapped port 4000 to 4000 of host) to the bot container. From within the bot container port 4000 is reachable. From outside the container it says "connection refused".

Your FULL config.json (remove your username, password, gmapkey and any other private info)

{
...
"websocket": {
"start_embedded_server": true,
"server_url": "127.0.0.1:4000"
}
...
}

Steps to Reproduce

docker-compose up from the current master

Other Information

OS:
ubuntu 14.04
Branch:
master
Git Commit:
42d670a
Python Version:
Python 2.7.12

@Lntnam
Copy link

Lntnam commented Sep 1, 2016

Can someone help to explain what is the use for this socket io? My web view is working fine without this config.

@sskes
Copy link

sskes commented Sep 1, 2016

GET http://192.168.4.15:8000/inventory-**********.json
GET http://192.168.4.15:8000/location-**********.json
GET http://192.168.4.15:8000/catchable-**********.json
GET http://127.0.0.1:4000/socket.io/?EIO=3&transport=polling&t=LRd2mma
GET http://192.168.4.15:8000/location-**********.json
GET http://192.168.4.15:8000/catchable-**********.json

keep send request to 127.0.0.1 for socker.io
other request send to private Ip (192.168.4.15)

maybe this is why mapping port 4000 won't work.
browser send to 127.0.0.1 (localhost) , not docker server ip ,nor docker container ip
i use docker version too , never make map works.

@jovobe
Copy link
Contributor Author

jovobe commented Sep 1, 2016

browser send to 127.0.0.1 (localhost) , not docker server ip ,nor docker container ip

I already changed the IP in the main.js to the one from the server it changed nothing.

@sskes
Copy link

sskes commented Sep 1, 2016

i change two ip and then i finally success.

step 1 / change websocket url from config
"websocket": {
"start_embedded_server": true,
"server_url": "127.0.0.1:4000" <--- change to 0.0.0.0:4000

step 2 / change main.js
socket_io = io.connect('127.0.0.1:4000'); <--- change to your docker server ip
for me , is 192.168.4.15:4000

that's it.

you have to change config, make socket not only listen on 127.0.0.1(localhost)
change to 0.0.0.0 ,seems make server list on all network interface
and i also map port 4000 to outside

@k4n30
Copy link
Contributor

k4n30 commented Sep 1, 2016

Closing as it's a config issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants