Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问怎么构建一个websocket的client? #289

Open
trash-boy opened this issue Dec 14, 2023 · 1 comment
Open

请问怎么构建一个websocket的client? #289

trash-boy opened this issue Dec 14, 2023 · 1 comment

Comments

@trash-boy
Copy link
Contributor

switch zconf.GlobalObject.Mode {
	case zconf.ServerModeTcp:
		go s.ListenTcpConn()
	case zconf.ServerModeWebsocket:
		fmt.Println("go to websocket")
		go s.ListenWebsocketConn()
	case zconf.ServerModeKcp:
		go s.ListenKcpConn()
	default:
		go s.ListenTcpConn()
		go s.ListenWebsocketConn()
	}

为什么默认开启是tcp + webscoket,而只有websocket不需要开启tcp服务吗?

@aceld
Copy link
Owner

aceld commented Dec 14, 2023

case zconf.ServerModeWebsocket 这个case我理解就是你需要的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants