【已实现】继续发布任务,谁有兴趣帮虎绿林写个内信和@消息的WebSocket推送服务
@罐子,@xggz,@老虎会游泳,消息推送到 URL 这个实现后,我来基于此实现 WebSocket 推送服务
URL
WebSocket
@rkonfj,你程序修改一下不就可以实现吗。 一加8Pro
@rkonfj,。。。 一加8Pro
@rkonfj,可以使用 canal go 客户端连接推送数据源: https://github.com/withlin/canal-go
@老虎会游泳,怎么审核
可以让chatgpt4试试
@rkonfj,https://hu60.cn/q.php/bbs.topic.80876.html 让uid 1在后台执行SQL添加审核权限
@老虎会游泳,我在 https://github.com/rkonfj/hu60bot 程序里加入了 WebSocket 服务器的支持,你要试试吗?
@rkonfj,客户端怎么连接websocket服务器,采用什么身份认证机制?
@rkonfj,看起来是 ws://127.0.0.1:4860/v1/ws 通过 Cookie hu60_sid 认证
@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
@旧人,你连上推送服务后它偶尔会崩溃,你做了什么特别的操作吗?
@老虎会游泳,我用了两个插件,一个是我那个推送插件,一个是·@rkonfj,的hu60bot插件,似乎也是WebSocket推送,不知道会不会有冲突?
@罐子,@xggz,@老虎会游泳,消息推送到
URL
这个实现后,我来基于此实现WebSocket
推送服务@rkonfj,你程序修改一下不就可以实现吗。
一加8Pro
@rkonfj,。。。
一加8Pro
@rkonfj,可以使用 canal go 客户端连接推送数据源:
https://github.com/withlin/canal-go
@老虎会游泳,怎么审核
可以让chatgpt4试试
@rkonfj,https://hu60.cn/q.php/bbs.topic.80876.html
让uid 1在后台执行SQL添加审核权限
@老虎会游泳,我在 https://github.com/rkonfj/hu60bot 程序里加入了 WebSocket 服务器的支持,你要试试吗?
@rkonfj,客户端怎么连接websocket服务器,采用什么身份认证机制?
@rkonfj,看起来是 ws://127.0.0.1:4860/v1/ws 通过 Cookie hu60_sid 认证
@rkonfj,程序有时候会崩溃
@旧人,你连上推送服务后它偶尔会崩溃,你做了什么特别的操作吗?
@老虎会游泳,我用了两个插件,一个是我那个推送插件,一个是·@rkonfj,的hu60bot插件,似乎也是WebSocket推送,不知道会不会有冲突?
@旧人,提到的情况应该也是一个问题。手机和电脑多个设备或者多个插件使用 WebSocket 时,对于同一个用户是否允许建立多个 连接?目前是允许多个用户建立连接,但是只有最新的连接会收到站内的新消息。