-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bridge): add WebSocket bridge (#263)
* feat(bridge): add WebSocket bridge * feat(bridge): send DataFrame back to WebSocket connection * feat(bridge): broadcast data to multi connections in WebSocket bridge * refactor: remove session in context * set websocket conn payload type * feat(websocket): broadcast offline message * Revert "feat(websocket): broadcast offline message" This reverts commit da76906. Co-authored-by: venjiang <venjiang@gmail.com>
- Loading branch information
1 parent
4779f7f
commit 6f527f9
Showing
17 changed files
with
507 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package core | ||
|
||
import "github.com/yomorun/yomo/core/frame" | ||
|
||
// Bridge is an interface of bridge which connects the clients of different transport protocols (f.e. WebSocket) with zipper. | ||
type Bridge interface { | ||
// Name returns the name of bridge. | ||
Name() string | ||
|
||
// Addr returns the address of bridge. | ||
Addr() string | ||
|
||
// ListenAndServe starts a server with a given handler. | ||
ListenAndServe(handler func(ctx *Context)) error | ||
|
||
// Send the data to clients. | ||
Send(f frame.Frame) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.