-
Notifications
You must be signed in to change notification settings - Fork 1
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
Trd 251 tradelogs allow register webhook on new trade #38
Trd 251 tradelogs allow register webhook on new trade #38
Conversation
} | ||
|
||
func (b *Broadcaster) addConn(event, maker string, conn *websocket.Conn) { | ||
ID := xid.New().String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ID := xid.New().String() | |
id := xid.New().String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
for { | ||
b.mu.Lock() | ||
for _, cons := range b.clients { | ||
for id, c := range cons { | ||
if _, _, err := c.ws.ReadMessage(); err != nil { | ||
if websocket.IsCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway, websocket.CloseNoStatusReceived) { | ||
b.l.Infow("socket is closed", "id", id) | ||
delete(cons, id) | ||
} | ||
} | ||
} | ||
} | ||
b.mu.Unlock() | ||
time.Sleep(time.Minute) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ what will be returned if there is no message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no msg, read message will return nil
|
||
type Con struct { | ||
id string | ||
ws *websocket.Conn | ||
eventHash string | ||
maker string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if a connection want to subscribe to multiple eventHashes and makers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't do that here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.