private static ServerHandshake GenerateResponseHandshake(ClientHandshake aHandshake) { var aResponseHandshake = new ServerHandshake { Location = string.Format("ws://{0}{1}", aHandshake.Host, aHandshake.ResourcePath), Origin = aHandshake.Origin, SubProtocol = aHandshake.SubProtocol, AnswerKey = GenerateAnswerKey(aHandshake.Key) }; return aResponseHandshake; }
private static void SendServerHandshake(ServerHandshake aHandshake, Context context) { // generate a byte array representation of the handshake including the answer to the challenge byte[] handshakeBytes = context.UserContext.Encoding.GetBytes(aHandshake.ToString()); context.UserContext.SendRaw(handshakeBytes); }