8000 x/net/websocket: Add the Conn.FrameDataLength and NewClient2 by ruyi789 · Pull Request #191 · golang/net · GitHub
[go: up one dir, main page]

Skip to content

x/net/websocket: Add the Conn.FrameDataLength and NewClient2 #191

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update client.go
add NewClient2
  • Loading branch information
ruyi789 authored Aug 28, 2023
commit 970920ab15b3d6de8acf8be968b26cb36c065c45
15 changes: 14 additions & 1 deletion websocket/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,20 @@ func NewConfig(server, origin string) (config *Config, err error) {
func NewClient(config *Config, rwc io.ReadWriteCloser) (ws *Conn, err error) {
br := bufio.NewReader(rwc)
bw := bufio.NewWriter(rwc)
err = hybiClientHandshake(config, br, bw)
_, err = hybiClientHandshake(config, br, bw)
if err != nil {
return
}
buf := bufio.NewReadWriter(br, bw)
ws = newHybiClientConn(config, buf, rwc)
return
}

// NewClient2 creates a new WebSocket client connection over rwc.
func NewClient2(config *Config, rwc io.ReadWriteCloser) (ws *Conn, resp *http.Response, err error) {
br := bufio.NewReader(rwc)
bw := bufio.NewWriter(rwc)
resp, err = hybiClientHandshake(config, br, bw)
if err != nil {
return
}
Expand Down
0