kone-net / go-chat Goto Github PK
View Code? Open in Web Editor NEWgo-chat.使用Go基于WebSocket开发的web聊天应用。单聊,群聊。文字,图片,语音,视频消息,屏幕共享,剪切板图片,基于WebRTC的P2P语音通话,视频聊天。
go-chat.使用Go基于WebSocket开发的web聊天应用。单聊,群聊。文字,图片,语音,视频消息,屏幕共享,剪切板图片,基于WebRTC的P2P语音通话,视频聊天。
gorilla/websocket的文档写道:
Connections support one concurrent reader and one concurrent writer.
Applications are responsible for ensuring that no more than one goroutine calls the write methods (NextWriter, SetWriteDeadline, WriteMessage, WriteJSON, EnableWriteCompression, SetCompressionLevel) concurrently and that no more than one goroutine calls the read methods (NextReader, SetReadDeadline, ReadMessage, ReadJSON, SetPongHandler, SetPingHandler) concurrently.
The Close and WriteControl methods can be called concurrently with all other methods.
所以在读写websocket消息的两个goroutine中并发调用WriteMessage方法是不可以的
最近想自己搭一套前台界面,这个前后端项目用到的技术正好是自己打算用的。感谢~
在2台不同的电脑,视频聊天,可以拉起聊天,但是都是只能看到自己的画面,偶尔能看到对方的画面,可以通过调整什么配置之类的来解决这个问题吗?
conn, err := upGrader.Upgrade(c.Writer, c.Request, nil) //1
if err != nil {
retrun
}
messageType, message, err := conn.ReadMessage() //2
if err != nil {
lg.Debug("conn.ReadMessage err:", err, ", messageType:", messageType)
return
}
错误:time="2023-07-06T19:10:17+08:00" level=debug msg="conn.ReadMessage err:read tcp 127.0.0.1:8080->127.0.0.1:54657: wsarecv: An established connection was aborted by the software in your host machine., messageType:-1"
从1到2等待了4min, 请问是什么原因?
另外 想请问下作者可以分享一下 在写这一项目代码有受过哪些书籍或者项目的影响吗?
想学习下长长见识 理解下代码的设计思路 感谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.