func (p *ProtocolHandler) RegisterHandler(messageName string, handler MessageHandler) error {
	p.messageHandlersLock.Lock()
	defer p.messageHandlersLock.Unlock()
	if _, found := p.messageHandlers[messageName]; found {
		return fmt.Errorf("handler for message name %s already exists", messageName)
	}

	p.messageHandlers[messageName] = handler
	return nil
}
// RegisterHandler registers a handler for a protocol.
RegisterHandler registers a handler for a protocol.
// RegisterHandler registers a handler for a protocol .
func (p *ProtocolHandler) RegisterHandler(messageName string, handler MessageHandler) error {
	p.messageHandlersLock.Lock()
	defer p.messageHandlersLock.Unlock()
	if _, found := p.messageHandlers[messageName]; found {
		return fmt.Errorf("handler for message name %s already exists", messageName)
	}
	p.messageHandlers[messageName] = handler
	return nil
}
func ( p * ProtocolHandler ) RegisterHandler ( messageName string , handler MessageHandler ) error { p . messageHandlersLock . Lock ( ) defer p . messageHandlersLock . Unlock ( ) if _ , found := p . messageHandlers [ messageName ] ; found { return fmt . Errorf ( " " , messageName ) } p . messageHandlers [ messageName ] = handler return nil }
RegisterHandler registers a handler for a protocol.
RegisterHandler registers a handler for a protocol .