/// <summary> /// Sends a message to the lobby on behalf of the current user. You must be connected to the lobby you are messaging. /// You should use this function for message sending if you are not using the built in networking layer for the lobby. /// If you are, you should use <see cref="SendNetworkMessage" /> instead. /// <para>This method has a rate limit of 10 messages per 5 seconds.</para> /// </summary> /// <param name="lobbyId"></param> /// <param name="data"></param> /// <param name="callback"></param> public void SendLobbyMessage(long lobbyId, byte[] data, SendLobbyMessageHandler callback) { GCHandle wrapped = GCHandle.Alloc(callback); Methods.SendLobbyMessage(methodsPtr, lobbyId, data, data.Length, GCHandle.ToIntPtr(wrapped), SendLobbyMessageCallbackImpl); }
private static void SendLobbyMessageCallbackImpl(IntPtr ptr, Result result) { GCHandle h = GCHandle.FromIntPtr(ptr); SendLobbyMessageHandler callback = (SendLobbyMessageHandler)h.Target; h.Free(); callback(result); }
public void SendLobbyMessage(Int64 lobbyID, string data, SendLobbyMessageHandler handler) { SendLobbyMessage(lobbyID, Encoding.UTF8.GetBytes(data), handler); }