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

fix ws client #53

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion examples/goppy/demo-ws-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {
Resolve: func(c *Controller, ctx app.Context, ws web.WebsocketClient) {
wsc := ws.Create("ws://127.0.0.1:8088/ws")
wsc.SetHandler(c.EventListener, 99, 1, 65000)
go c.Ticker(wsc.Encode)
go c.Ticker(wsc.SendEvent)
wsc.OnClose(func(cid string) {
fmt.Println("server close connect")
ctx.Close()
Expand Down
5 changes: 0 additions & 5 deletions plugins/web/http_server_context_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions plugins/web/http_server_router_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/web/ws_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type (
}

WebsocketClientConnect interface {
Encode(eid websocket.EventID, in interface{})
SendEvent(eid websocket.EventID, in interface{})
ConnectID() string
Header(key, value string)
SetHandler(call websocket.ClientHandler, eids ...websocket.EventID)
Expand Down
5 changes: 0 additions & 5 deletions sdk/auth/jwt/jwt_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions sdk/auth/oauth/isp_google_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions sdk/auth/oauth/isp_yandex_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions sdk/log/message_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/netutil/websocket/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type (
}

Client interface {
Encode(eid EventID, in interface{})
SendEvent(eid EventID, in interface{})
ConnectID() string
Header(key, value string)
SetHandler(call ClientHandler, eids ...EventID)
Expand Down Expand Up @@ -146,7 +146,7 @@ func (v *cli) WriteToBus(b []byte) {
}
}

func (v *cli) Encode(eid EventID, in interface{}) {
func (v *cli) SendEvent(eid EventID, in interface{}) {
getEventModel(func(ev *event) {
ev.ID = eid
ev.Encode(in)
Expand Down
5 changes: 0 additions & 5 deletions sdk/netutil/websocket/event_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/netutil/websocket/observable.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type (

ObservableClient interface {
OnClose(cb func(cid string))
Encode(eid EventID, in interface{})
SendEvent(eid EventID, in interface{})
DelHandler(eids ...EventID)
SetHandler(call ClientHandler, eids ...EventID)
}
Expand Down Expand Up @@ -48,7 +48,7 @@ func (v *_obs) Subscribe(eid EventID, in interface{}) Subscription {
if in == nil {
return
}
v.cli.Encode(eid, in)
v.cli.SendEvent(eid, in)
},
sync: iosync.NewSwitch(),
}
Expand Down