Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 88ae539f54 |
2
go.mod
2
go.mod
@@ -4,4 +4,4 @@ go 1.24.5
|
||||
|
||||
require github.com/gorilla/websocket v1.5.3
|
||||
|
||||
require git.neurocipta.com/rogerferdinan/custom-rwmutex v1.0.0 // indirect
|
||||
require git.neurocipta.com/rogerferdinan/custom-rwmutex v1.0.0
|
||||
|
||||
@@ -23,9 +23,9 @@ type Client struct {
|
||||
func NewClient(conn *websocket.Conn, subscribedPath string) *Client {
|
||||
return &Client{
|
||||
Conn: conn,
|
||||
Send: make(chan []byte, 64),
|
||||
Send: make(chan []byte, 2),
|
||||
SubscribedPath: subscribedPath,
|
||||
done: make(chan struct{}),
|
||||
done: make(chan struct{}, 1),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ type Hub struct {
|
||||
|
||||
func NewHub() *Hub {
|
||||
return &Hub{
|
||||
Broadcast: make(chan []byte),
|
||||
Register: make(chan *Client),
|
||||
Unregister: make(chan *Client),
|
||||
Clients: make(map[*Client]bool),
|
||||
Broadcast: make(chan []byte, 1),
|
||||
Register: make(chan *Client, 1),
|
||||
Unregister: make(chan *Client, 1),
|
||||
Clients: make(map[*Client]bool, 1),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ func (b *SafeWebsocketClientBuilder) Build(ctx context.Context) (*SafeWebsocketC
|
||||
reconnectCh: make(chan struct{}, 1),
|
||||
isConnected: false,
|
||||
doneMap: NewSafeMap[string, chan struct{}](),
|
||||
writeChan: make(chan Message),
|
||||
writeChan: make(chan Message, 1),
|
||||
}
|
||||
|
||||
if b.authenticateFn != nil {
|
||||
@@ -425,7 +425,7 @@ func (wsClient *SafeWebsocketClient) reconnectHandler() {
|
||||
}
|
||||
|
||||
func (wsClient *SafeWebsocketClient) ReconnectChannel() <-chan struct{} {
|
||||
reconnectCh := make(chan struct{})
|
||||
reconnectCh := make(chan struct{}, 1)
|
||||
wsClient.mu.WriteHandler(func() error {
|
||||
wsClient.reconnectChans = append(wsClient.reconnectChans, reconnectCh)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user