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

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); }


  • Hi,

    What are you trying to do?
    You need one of Photon SDKs (most likely javascript or dotnet) to access Photon functionality instead of using WebSocket.
  • hunglv
    edited July 2016
    Hi Vadim,
    Thanks for support, I trying build client unity use code dotnet to WebGL, but when I connect from WebGL to server I got Error "Wrong parameter type 1 (InitEncryptionRequest.ClientKey): should be Byte[] but received String"
    I want the sample webGL using dotnet socket from unity, Please help me?
  • Why don't yo use Photon Unity dotnet SDK?
  • Hi Supporter,
    Thank for your support,
    vadim said:

    Why don't yo use Photon Unity dotnet SDK?

    Because We has a project unity build and run in android and ios, and today we want build it to webGL, We not want build new it in javascript. could you support me a solution?

    Thanks you.
  • Do you use Photon currently? If yes, which SDK or plugin exactly?
    As I said Photon Unity dotnet SDK and PUN have WebGL support.
  • Hi Supporter,
    I used Photon SDK V4.0 and not use PUN for unity. Do you suggest I use PUN ++ for unity?
  • Did you try to set connection protocol to WebSocket or WebSocketSecure in LoadBalancingClient constructor?