public Push Leave(int timeout)
{
Action onClose = () =>
{
_socket.Log("channel", $"leave ${_topic}"); //jfis - seems odd to tie logs to socket
Trigger(Phoenix.CHANNEL_EVENT_CLOSE);//, "leave");
};
var leavePush = new Push(this, Phoenix.CHANNEL_EVENT_LEAVE, Phoenix.EMPTY_JS_OBJECT, timeout);
leavePush
.Receive("ok", (_) => onClose())
.Receive("timeout", (_) => onClose());
leavePush.Send();
if (!CanPush()) //jfis - if cant push simulate ok
{
leavePush.Trigger("ok", Phoenix.EMPTY_JS_OBJECT);
}
return leavePush;
}