Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Wrong parameter type 1 (InitEncryptionRequest.ClientKey): should be Byte[] but received String.

$
0
0
Hi Supporter,
I have a questing, when i config client run with webGL, I got problem Wrong parameter type 1 (InitEncryptionRequest.ClientKey): should be Byte[] but received String.
My code client i use:

public void SendDemo(){
websocket = new WebSocket(uri);
MessageBase _m = new MessageBase ();
_f = u.ToDictionary ();
OperationRequest request = new OperationRequest ();
request.OperationCode = (byte)0;

request.Parameters = _f;
websocket.Send (SerializeInternalOperationRequest(request));
}
public byte[] SerializeInternalOperationRequest(OperationRequest operationRequest)
{
Dictionary<string, object> h1 = new Dictionary<string, object> ();
h1.Add("irq", operationRequest.OperationCode);
if (operationRequest.Parameters != null)
{
List<object> list = new List<object>(operationRequest.Parameters.Count * 2);
foreach (KeyValuePair<byte, object> pair in operationRequest.Parameters)
{
list.Add(pair.Key);
list.Add(pair.Value);
}
h1.Add("vals", list);
}
return GetMessage(h1);
}
private static byte[] GetMessage(IDictionary h)
{
JsonSerializer serializer = new JsonSerializer();
serializer.NullValueHandling = NullValueHandling.Ignore;
StringBuilder sb = new StringBuilder();
using (StringWriter writer = new StringWriter(sb))
{

using (var jsonTextWriter = new JsonTextWriter(writer))
{
serializer.Serialize (jsonTextWriter, h);

}

writer.Flush();
}
string s = string.Format("~m~{0}~m~~j~{1}", sb.Length + 3, sb);
return Encoding.UTF8.GetBytes(s);
}


Viewing all articles
Browse latest Browse all 15755

Trending Articles