【已实现】继续发布任务,谁有兴趣帮虎绿林写个内信和@消息的WebSocket推送服务

回复列表(42|显示机器人聊天)
  • @Ta / 2023-03-15 / /
    @张小强,稳如狗
  • @Ta / 2023-03-15 / /
    @老虎会游泳,太厉害了
  • @Ta / 2023-03-15 / /

    @罐子@xggz@老虎会游泳,消息推送到 URL 这个实现后,我来基于此实现 WebSocket 推送服务

  • @Ta / 2023-03-15 / /

    @rkonfj,你程序修改一下不就可以实现吗。
    一加8Pro

  • @Ta / 2023-03-15 / /
    被锁定
    层主 @rkonfj 于 2023-03-15 17:14 删除了该楼层。
  • @Ta / 2023-03-15 / /
    @罐子,我现在拿不到所有新的站内消息,所以不能实现推送
  • @Ta / 2023-03-15 / /

    @rkonfj,。。。
    一加8Pro

  • @Ta / 2023-03-15 / /
    被锁定
    层主 @rkonfj 于 2023-03-15 17:14 删除了该楼层。
  • @Ta / 2023-03-15 / /

    @rkonfj,可以使用 canal go 客户端连接推送数据源:
    https://github.com/withlin/canal-go

  • @Ta / 2023-03-15 / /
    被锁定
    层主 @rkonfj 于 2023-03-15 17:13 删除了该楼层。
  • @Ta / 2023-03-16 / /

    @老虎会游泳,怎么审核
    Dingtalk_20230316150313.jpg(77.5 KB)

  • @Ta / 2023-03-16 / /

    可以让chatgpt4试试

  • @Ta / 2023-03-16 / /

    @rkonfjhttps://hu60.cn/q.php/bbs.topic.80876.html
    让uid 1在后台执行SQL添加审核权限

  • @Ta / 2023-03-17 / /

    @老虎会游泳,我在 https://github.com/rkonfj/hu60bot 程序里加入了 WebSocket 服务器的支持,你要试试吗?

  • @Ta / 2023-03-19 / /

    @rkonfj,客户端怎么连接websocket服务器,采用什么身份认证机制?

  • @Ta / 2023-03-19 / /

    @rkonfj,看起来是 ws://127.0.0.1:4860/v1/ws 通过 Cookie hu60_sid 认证

  • @Ta / 2023-03-19 / /

    @rkonfj,程序有时候会崩溃

    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]: panic: runtime error: invalid memory address or nil pointer dereference
    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3e5ed8]
    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]: goroutine 53 [running]:
    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]: github.com/gorilla/websocket.(*Conn).Close(...)
    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]:         /root/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:345
    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]: github.com/rkonfj/hu60bot/server.(*WebsocketManager).Run.func1.1({0x4595, {0x40004a4bf6, 0x6}, {0x0, 0x0}, 0x5211e6dc, 0x1, 0x0}, 0x0?)
    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]:         /root/chatgpt/hu60bot/server/server.go:181 +0x198
    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]: created by github.com/rkonfj/hu60bot/server.(*WebsocketManager).Run.func1
    Mar 19 19:26:07 hu60-kunpeng run.sh[2356097]:         /root/chatgpt/hu60bot/server/server.go:177 +0x460
    Mar 19 19:26:12 hu60-kunpeng run.sh[2356097]: Sun Mar 19 19:26:12 CST 2023
    Mar 19 19:26:12 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:12+08:00" level=debug msg="conversation: 0/0, openai tokens usage: 0/0/0"
    Mar 19 19:26:12 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:12+08:00" level=info msg="bot listening on 127.0.0.1:4860 for interact now. websocket endpoint is /v1/ws"
    Mar 19 19:26:12 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:12+08:00" level=info msg="bot watching db event now"
    Mar 19 19:26:12 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:12+08:00" level=info msg="bot watching for chat now. sid is xxx, conversation window is 30m0s"
    Mar 19 19:26:12 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:12+08:00" level=info msg="user ChatGPT is connected"
    Mar 19 19:26:12 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:12+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:13 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:13+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:13 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:13+08:00" level=info msg="user 老虎会游泳 is connected"
    Mar 19 19:26:13 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:13+08:00" level=info msg="user rkonfj is connected"
    Mar 19 19:26:19 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:19+08:00" level=info msg="user rkonfj is disconnected"
    Mar 19 19:26:30 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:30+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:30 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:30+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:31 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:31+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:31 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:31+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:31 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:31+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:31 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:31+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:40+08:00" level=info msg="user 旧人 is disconnected"
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]: panic: runtime error: invalid memory address or nil pointer dereference
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3e5ed8]
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]: goroutine 49 [running]:
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]: github.com/gorilla/websocket.(*Conn).Close(...)
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]:         /root/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:345
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]: github.com/rkonfj/hu60bot/server.(*WebsocketManager).Run.func1.1({0x4595, {0x40003aadd6, 0x6}, {0x0, 0x0}, 0x5211e6dc, 0x1, 0x0}, 0x0?)
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]:         /root/chatgpt/hu60bot/server/server.go:181 +0x198
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]: created by github.com/rkonfj/hu60bot/server.(*WebsocketManager).Run.func1
    Mar 19 19:26:40 hu60-kunpeng run.sh[2356097]:         /root/chatgpt/hu60bot/server/server.go:177 +0x460
    Mar 19 19:26:45 hu60-kunpeng run.sh[2356097]: Sun Mar 19 19:26:45 CST 2023
    Mar 19 19:26:45 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:45+08:00" level=debug msg="conversation: 0/0, openai tokens usage: 0/0/0"
    Mar 19 19:26:45 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:45+08:00" level=info msg="bot listening on 127.0.0.1:4860 for interact now. websocket endpoint is /v1/ws"
    Mar 19 19:26:45 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:45+08:00" level=info msg="bot watching db event now"
    Mar 19 19:26:45 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:45+08:00" level=info msg="bot watching for chat now. sid is xxx, conversation window is 30m0s"
    Mar 19 19:26:45 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:45+08:00" level=info msg="user 老虎会游泳 is connected"
    Mar 19 19:26:45 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:45+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:26:46 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:46+08:00" level=info msg="user ChatGPT is connected"
    Mar 19 19:26:46 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:26:46+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:27:41 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:27:41+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:27:41 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:27:41+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:27:42 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:27:42+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:27:44 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:27:44+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:27:45 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:27:45+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:00+08:00" level=info msg="user 旧人 is disconnected"
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]: panic: runtime error: invalid memory address or nil pointer dereference
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3e5ed8]
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]: goroutine 39 [running]:
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]: github.com/gorilla/websocket.(*Conn).Close(...)
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]:         /root/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:345
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]: github.com/rkonfj/hu60bot/server.(*WebsocketManager).Run.func1.1({0x4595, {0x400032be46, 0x6}, {0x0, 0x0}, 0x5211e6dc, 0x1, 0x0}, 0x0?)
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]:         /root/chatgpt/hu60bot/server/server.go:181 +0x198
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]: created by github.com/rkonfj/hu60bot/server.(*WebsocketManager).Run.func1
    Mar 19 19:28:00 hu60-kunpeng run.sh[2356097]:         /root/chatgpt/hu60bot/server/server.go:177 +0x460
    Mar 19 19:28:05 hu60-kunpeng run.sh[2356097]: Sun Mar 19 19:28:05 CST 2023
    Mar 19 19:28:05 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:05+08:00" level=debug msg="conversation: 0/0, openai tokens usage: 0/0/0"
    Mar 19 19:28:05 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:05+08:00" level=info msg="bot listening on 127.0.0.1:4860 for interact now. websocket endpoint is /v1/ws"
    Mar 19 19:28:05 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:05+08:00" level=info msg="bot watching db event now"
    Mar 19 19:28:05 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:05+08:00" level=info msg="bot watching for chat now. sid is xxx, conversation window is 30m0s"
    Mar 19 19:28:05 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:05+08:00" level=info msg="user 老虎会游泳 is connected"
    Mar 19 19:28:05 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:05+08:00" level=info msg="user ChatGPT is connected"
    Mar 19 19:28:05 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:05+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:28:06 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:06+08:00" level=info msg="user 旧人 is connected"
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]: time="2023-03-19T19:28:22+08:00" level=info msg="user 旧人 is disconnected"
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]: panic: runtime error: invalid memory address or nil pointer dereference
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3e5ed8]
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]: goroutine 35 [running]:
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]: github.com/gorilla/websocket.(*Conn).Close(...)
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]:         /root/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:345
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]: github.com/rkonfj/hu60bot/server.(*WebsocketManager).Run.func1.1({0x4595, {0x4000388916, 0x6}, {0x0, 0x0}, 0x5211e6dc, 0x1, 0x0}, 0x0?)
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]:         /root/chatgpt/hu60bot/server/server.go:181 +0x198
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]: created by github.com/rkonfj/hu60bot/server.(*WebsocketManager).Run.func1
    Mar 19 19:28:22 hu60-kunpeng run.sh[2356097]:         /root/chatgpt/hu60bot/server/server.go:177 +0x460
    
  • @Ta / 2023-03-19 / /

    @旧人,你连上推送服务后它偶尔会崩溃,你做了什么特别的操作吗?

  • @Ta / 2023-03-19 / /

    @老虎会游泳,我用了两个插件,一个是我那个推送插件,一个是·@rkonfj,的hu60bot插件,似乎也是WebSocket推送,不知道会不会有冲突?

  • @Ta / 2023-03-19 / /
    @老虎会游泳,出错这块代码是读取客户端消息出错时服务器主动关闭连接,怀疑是关闭了已经关闭的连接再次关闭会导致 `nil pointer`,改了下关闭的逻辑。同时,打印相关错误的 debug 日志。https://github.com/rkonfj/hu60bot/blob/54087f5d696a8d1260a13a4b5dd43b2b61831700/server/server.go#L106-L109

    @旧人,提到的情况应该也是一个问题。手机和电脑多个设备或者多个插件使用 WebSocket 时,对于同一个用户是否允许建立多个 连接?目前是允许多个用户建立连接,但是只有最新的连接会收到站内的新消息。
添加新回复
回复需要登录