private void WebSock_MessageReceived(object sender, MessageReceivedEventArgs e) { try { var message = JsonConvert.DeserializeObject <BaseMessage>(e.Message); LastSequence = message.Sequence; var newMessage = MessageInitializer.BuildMessage((int)message.OpCode, message.OpCode == GatewayOpCode.Dispatch ? e.Message : message.Data.ToString()); HandlerManager.GetHandler((int)message.OpCode)?.Invoke(null, newMessage); } catch { } }
public void PreInitialize() { MessageInitializer.Initialize(); HandlerManager.RegisterAll(); }