コード例 #1
0
        public void OnObjectMessage(string msg)
        {
            var parsed = BitfinexSerialization.Deserialize <MessageBase>(msg);

            switch (parsed.Event)
            {
            case MessageType.Pong:
                PongResponse.Handle(msg, _streams.PongSubject);
                break;

            case MessageType.Error:
                ErrorResponse.Handle(msg, _streams.ErrorSubject);
                break;

            case MessageType.Info:
                InfoResponse.Handle(msg, _streams.InfoSubject);
                break;

            case MessageType.Auth:
                AuthenticationResponse.Handle(msg, _streams.AuthenticationSubject);
                break;

            case MessageType.Conf:
                ConfigurationResponse.Handle(msg, _streams.ConfigurationSubject);
                break;

            case MessageType.Subscribed:
                OnSubscription(BitfinexSerialization.Deserialize <SubscribedResponse>(msg));
                break;

            case MessageType.Unsubscribed:
                UnsubscribedResponse.Handle(msg, _streams.UnsubscriptionSubject);
                break;
                //default:
                //    Log.Warning($"Missing handler for public stream, data: '{msg}'");
                //    break;
            }
        }