public void Send(byte[] buffer) { var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned); UnityPeerJS.Send(_peer._peerIndex, _connIndex, pinnedBuffer.AddrOfPinnedObject(), buffer.Length); pinnedBuffer.Free(); }
/// <summary> /// Connect to another client /// </summary> /// <param name="remoteId">Peer ID of target client</param> public void Connect(string remoteId) { var remoteIdStr = Marshal.StringToHGlobalUni(remoteId); UnityPeerJS.Connect(_peerIndex, remoteIdStr); Marshal.FreeHGlobal(remoteIdStr); }
public void Send(string str) { UnityPeerJS.Send(Peer._peerIndex, _connIndex, str, str.Length); }
public void Connect(string remoteId) { UnityPeerJS.Connect(_peerIndex, remoteId); }