You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, when using websocket, multiple events are set in empty namespace. The server received a namespace connection request, and send a message in its OnNamespaceConnected, the client may panic because ns, ok = c.connectedNamespaces[namespace] is not executed. I'd like to know if this is a bug or if there's something wrong with my usage. Sorry for my bad English
func (c*Conn) askConnect(ctx context.Context, namespacestring) (*NSConn, error) {
......// println("ask connect")
_, err=c.Ask(ctx, connectMessage) // waits for answer no matter if already connected on the other side.iferr!=nil {
returnnil, err
}
// println("got connect")// re-check, maybe connected so far (can happen by a simultaneously `Connect` calls on both server and client, which is not the standard way)// c.connectedNamespacesMutex.RLock()// ns, ok = c.connectedNamespaces[namespace]// c.connectedNamespacesMutex.RUnlock()// if ok {// return ns, nil// }// ******************************************************************************************// The message was received before executing the following code// ******************************************************************************************c.connectedNamespacesMutex.Lock()
c.connectedNamespaces[namespace] =nsc.connectedNamespacesMutex.Unlock()
// println("we're connected")// c.writeEmptyReply(genWaitConfirmation(reply.wait))// println("wrote: " + genWaitConfirmation(reply.wait))// c.sendConfirmation(reply.wait)c.notifyNamespaceConnected(ns, connectMessage)
returnns, nil
}
return ns.events.fireEvent(ns, msg)ns.events is nil
Hi, when using websocket, multiple events are set in empty namespace. The server received a namespace connection request, and send a message in its
OnNamespaceConnected
, the client may panic becausens, ok = c.connectedNamespaces[namespace]
is not executed. I'd like to know if this is a bug or if there's something wrong with my usage. Sorry for my bad EnglishHere is the sample code.
Here is some source code I found.
return ns.events.fireEvent(ns, msg)
ns.events
is nilThe text was updated successfully, but these errors were encountered: