{"action":"created","issue":{"url":"https://api.github.com/repos/googollee/go-socket.io/issues/143","repository_url":"https://api.github.com/repos/googollee/go-socket.io","labels_url":"https://api.github.com/repos/googollee/go-socket.io/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/googollee/go-socket.io/issues/143/comments","events_url":"https://api.github.com/repos/googollee/go-socket.io/issues/143/events","html_url":"https://github.com/googollee/go-socket.io/issues/143","id":173963931,"number":143,"title":"XHR poll error : Connection Refused","user":{"login":"AhmedX6","id":13573148,"avatar_url":"https://avatars3.githubusercontent.com/u/13573148?v=4","gravatar_id":"","url":"https://api.github.com/users/AhmedX6","html_url":"https://github.com/AhmedX6","followers_url":"https://api.github.com/users/AhmedX6/followers","following_url":"https://api.github.com/users/AhmedX6/following{/other_user}","gists_url":"https://api.github.com/users/AhmedX6/gists{/gist_id}","starred_url":"https://api.github.com/users/AhmedX6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AhmedX6/subscriptions","organizations_url":"https://api.github.com/users/AhmedX6/orgs","repos_url":"https://api.github.com/users/AhmedX6/repos","events_url":"https://api.github.com/users/AhmedX6/events{/privacy}","received_events_url":"https://api.github.com/users/AhmedX6/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-30T08:53:07Z","updated_at":"2017-12-06T13:00:06Z","closed_at":null,"author_association":"NONE","body":"Hello,\n\nI have a local server in Golang which implements socket :\n\n```\n`server, err := socketio.NewServer(nil)\nif err != nil {\n    log.Fatal(err)\n}\n\nserver.On(\"connection\", func(so socketio.Socket) {\n    fmt.Println(so.Id())\n})\n\nserver.On(\"error\", func(so socketio.Socket, err error) {\n    fmt.Println(\"error:\", err)\n})\n    http.Handle(\"/\", server)\nlog.Fatal(http.ListenAndServe(\":5000\", nil))`\n```\n\nI have an android app which uses 'io.socket:socket.io-client:0.7.0'\n\n```\n           `try {\n            IO.Options options = new IO.Options();\n            options.forceNew = true;\n            options.reconnection = true;\n            options.timeout = 20000;\n            options.port = 5000;\n\n            socket = IO.socket(\"http://192.168.0.50:5000/\", options); //ip of my computer\n            socket.connect();\n        } catch (URISyntaxException e) {\n            e.printStackTrace();\n        }`\n```\n\nIt makes me an xhr poll error : java.net.ConnectException: failed to connect to /192.168.0.50 (port 5000) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused)\n\nCan you tell me why ? Maybe the two library are not compatible ??... I have no idea..\n\nThank you !\n"},"comment":{"url":"https://api.github.com/repos/googollee/go-socket.io/issues/comments/349632578","html_url":"https://github.com/googollee/go-socket.io/issues/143#issuecomment-349632578","issue_url":"https://api.github.com/repos/googollee/go-socket.io/issues/143","id":349632578,"user":{"login":"AhmedX6","id":13573148,"avatar_url":"https://avatars3.githubusercontent.com/u/13573148?v=4","gravatar_id":"","url":"https://api.github.com/users/AhmedX6","html_url":"https://github.com/AhmedX6","followers_url":"https://api.github.com/users/AhmedX6/followers","following_url":"https://api.github.com/users/AhmedX6/following{/other_user}","gists_url":"https://api.github.com/users/AhmedX6/gists{/gist_id}","starred_url":"https://api.github.com/users/AhmedX6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AhmedX6/subscriptions","organizations_url":"https://api.github.com/users/AhmedX6/orgs","repos_url":"https://api.github.com/users/AhmedX6/repos","events_url":"https://api.github.com/users/AhmedX6/events{/privacy}","received_events_url":"https://api.github.com/users/AhmedX6/received_events","type":"User","site_admin":false},"created_at":"2017-12-06T13:00:06Z","updated_at":"2017-12-06T13:00:06Z","author_association":"NONE","body":" @KristinaEtc I forgot ... It was a long time ago now... I fixed the issue. I added cors, here is my last code :\r\n```\r\nc := cors.New(cors.Options{ \r\n\t\tAllowedOrigins:   []string{\"*\"}, \r\n\tAllowedMethods:   []string{\"GET\", \"POST\", \"PUT\", \"DELETE\"}, \r\n \t\tAllowCredentials: true, \r\n \t}) \r\n \r\n \r\n \thttp.Handle(\"/socket.io/\", c.Handler(server)) \r\n\tlog.Println(\"Serving at localhost:5000...\") \r\n\tlog.Fatal(http.ListenAndServe(\":5000\", nil)) \r\n\r\n```\r\nOn Android like this :\r\n\r\n```\r\ntry { \r\n                 IO.Options options = new IO.Options(); \r\n                options.forceNew = true; \r\n                 options.reconnection = true; \r\n                 options.port = 5000; \r\n                 options.multiplex = true; \r\n \r\n \r\n                 socket = IO.socket(ip, options); \r\n                 socket.connect(); \r\n               checkListenersForBroadcast(); \r\n            } catch (URISyntaxException e) { \r\n                 e.printStackTrace(); \r\n             } \r\n\r\n```\r\n\r\nAnd that's it ... It worked..."}}
{"actor":{"display_login":"AhmedX6"}}