public static string GenerateAccept(string clientKey) { using (var hasher = SHA1.Create()) { var rawKey = string.Concat(clientKey, ServerKey); var txtBuf = Constant.GetBytes(rawKey); var encBuf = hasher.ComputeHash(txtBuf); return(Convert.ToBase64String(encBuf)); } }
public async Task <bool> SendCloseAsync() { if (m_state != SocketState.Closed && m_state != SocketState.Closing) { var payLoad = Constant.GetBytes(Constant.CloseMessage); m_requestClose = true; return(await SendCloseAsync(payLoad)); } return(false); }
private async Task <bool> SendRawAsync(string message) { var buffer = Constant.GetBytes(message); return(await SendRawAsync(buffer)); }
public async Task <bool> SendStringAsync(string message) { var buffer = Constant.GetBytes(message); return(await SendFrameAsync(OpCode.Text, buffer)); }