void MatchReceive(PayloadResp msg) { recHooks.Where(kvp => kvp.Key.Equals(msg.status)) .Select(kvp => kvp.Value) .ToList() .ForEach(callback => callback(msg.response)); }
public void Trigger(string _event, PayloadResp _payload, string _ref = null) { OnMessage(_event, _payload, _ref); bindings.Where(kvp => kvp.Key.Equals(_event)) .Select(kvp => kvp.Value) .ToList() .ForEach(bind => bind.Invoke(_payload, _ref)); }
public void SetResponseListener() { waitingResponse = true; push_ref = channel.Socket.MakeRef(); refEvent = channel.ReplyEventName(push_ref); channel.On(refEvent, (payloadResp, refResp) => { CancelRefEvent(); waitingResponse = false; receivedResp = payloadResp; MatchReceive(payloadResp); }); }
public virtual void OnMessage(string _event, PayloadResp payloadResp, string _ref) { }
public void Trigger(string _status, PayloadResp payloadResp) { payloadResp.status = _status; channel.Trigger(refEvent, payloadResp); }
void OnNewMessage(PayloadResp payloadResp, string refResp) { chatDisplayString = payloadResp.body + "\n" + chatDisplayString; }