コード例 #1
0
        public async Task ReceiveAsync(LiveUrlInfo liveUrlInfo, string userAgent, List <Cookie> cookies)
        {
            var origin = $"https://mixch.tv";

            _websocket           = new Websocket();
            _websocket.Received += Websocket_Received;
            _websocket.Opened   += Websocket_Opened;

            var url = $"wss://chat.mixch.tv/{liveUrlInfo.Environment}/room/{liveUrlInfo.LiveId}";
            await _websocket.ReceiveAsync(url, userAgent, origin);

            // 切断後処理
            _heartbeatTimer.Enabled = false;
        }
コード例 #2
0
        public static async Task <LiveUrlInfo> GetLiveId(IDataSource dataSource, string input)
        {
            // LIVE_ID
            // https://mixch.tv/u/LIVE_ID/live

            var liveUrlInfo = new LiveUrlInfo();
            var match       = Regex.Match(input, regexLiveUrl);

            if (match.Success)
            {
                liveUrlInfo.Environment = match.Groups[1].Value;
                if (liveUrlInfo.Environment == "")
                {
                    liveUrlInfo.Environment = "torte";
                }
                liveUrlInfo.LiveId = match.Groups[2].Value;
            }
            else
            {
                throw new InvalidInputException();
            }
            return(liveUrlInfo);
        }