2016-09-08 10:38
浏览 943


I try to use the slack-sample bot from this blogpost . I've successfully created my api token, but i can not connect to the websocket server (the rtm.start request passs normally). I've get the error message

dial tcp connectex: No connection could be made because the target machine actively refused it

I've also tried to connect via a chrome app called Simple Web Socket Client and via a website based one tester. Both work well, i can establish a connection and i can send data.

I'm behind a proxy, but i only have troubles with golang's websocket.Dial function.

Does anybody know why this can happen?

I use:
- Windows 7 SP1 x64
- Golang 1.7.1 windows/amd64

Greetings Tonka

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • douqiu0351 2016-09-09 10:02

    If you are using gorilla/websocket, it has the ability to use a Proxy. From issue 107:

    import "net/http"
    var dialer = websocket.Dialer{
        Proxy: http.ProxyFromEnvironment,

    If you are using you should switch to gorilla/websocket.

    解决 无用
    打赏 举报

相关推荐 更多相似问题