2016-09-08 10:38
浏览 485


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

图片转代码服务由CSDN问答提供 功能建议

我尝试使用此博客文章中的slack-sample机器人 。 我已经成功创建了我的api令牌,但是无法连接到websocket服务器(rtm.start请求正常通过)。 我收到错误消息


我还尝试通过名为 Simple Web Socket Client 的Chrome应用和基于网站的 测试仪。 两者都很好,我可以建立连接并可以发送数据。

我在代理后面,但是我只对golang的websocket.Dial函数有麻烦。 \ n


- Windows 7 SP1 x64
- Golang 1.7.1 Windows / amd64

问候 Tonka

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douqiu0351
    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.

    点赞 评论