Exemplo n.º 1
0
 public DouyuClient(string roomId, Action <Dictionary <string, object> > messageHandler)
 {
     RoomId = roomId;
     client = new EasyClient();
     client.Initialize(new DouyuPackageFilter(), (package) => {
         messageHandler(DouyuUtility.Deserialize(package.Data));
     });
 }
Exemplo n.º 2
0
        public void Send(Dictionary <string, object> args)
        {
            DouyuPackageInfo package = new DouyuPackageInfo();
            string           argsStr = DouyuUtility.Serialize(args);

            byte[] data = package.Encode(argsStr);

            client.Send(new ArraySegment <byte>(data));
        }
Exemplo n.º 3
0
 public void Tick()
 {
     Send(
         new Dictionary <string, object>
     {
         { "type", "keeplive" },
         { "tick", DouyuUtility.UnixTimestamp().ToString() }
     }
         );
 }