feat: adding header support for client
This commit is contained in:
@@ -27,7 +27,9 @@ func main() {
|
||||
wsClient, err := client.NewSafeWebsocketClientBuilder().
|
||||
BaseHost("localhost").
|
||||
BasePort(8080).
|
||||
Path("/ws/test/data_1").
|
||||
Headers(map[string]string{
|
||||
"X-MBX-APIKEY": "abcd",
|
||||
}).Path("/ws/test/data_1").
|
||||
UseTLS(false).
|
||||
ChannelSize(1).
|
||||
Build(ctx)
|
||||
@@ -44,7 +46,7 @@ func main() {
|
||||
dataChannel := wsClient.DataChannel()
|
||||
|
||||
for data := range dataChannel {
|
||||
// _ = data
|
||||
fmt.Println(string(data))
|
||||
_ = data
|
||||
// fmt.Println(string(data))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ func main() {
|
||||
s, err := server.NewSafeWebsocketServerBuilder().
|
||||
BaseHost("localhost").
|
||||
BasePort(8080).
|
||||
ApiKey("").
|
||||
ApiKey("abcd").
|
||||
HandleFuncWebsocket("/ws/test/", "data_1", func(c chan []byte) {
|
||||
ticker := time.NewTicker(10 * time.Millisecond)
|
||||
for range ticker.C {
|
||||
|
||||
Reference in New Issue
Block a user