Пример #1
0
        static public void DispatchViaHttp(CallAttr attr, ResponseDelegate d, string url,
                                           object[] args = null, Dictionary <string, object> headers = null)
        {
            var ctx = new WebYieldContext(attr, d, url, args, headers);

            web_dispatchers.Add(ctx);
        }
Пример #2
0
 protected string ParseMethodName(string method, object[] args, ref CallAttr attr)
 {
     attr.notify  = false;
     attr.async   = false;
     attr.timeout = 5000;
     return(method);
 }
Пример #3
0
 public void Notify(Actor a, CallAttr attr, string method, object[] args)
 {
     WriteStream(Merge(new object[3] {
         KIND_NOTIFY_SEND,
         a.Id,
         method
     }, args));
 }
Пример #4
0
        public void Send(Actor a, CallAttr attr, string method, object[] args, ResponseDelegate d)
        {
            var msgid = TransportManager.NewMsgId();

            Dispatch(Merge(new object[5] {
                KIND_SEND,
                a.Id,
                msgid,
                method,
                null
            }, args), attr, msgid, d);
        }
Пример #5
0
        public WebYieldContext(CallAttr attr, ResponseDelegate d, string url,
                               object[] args, Dictionary <string, object> headers)
        {
            var str = Json.Serialize(args);

            byte[] body = System.Text.Encoding.ASCII.GetBytes(str);
            this.d          = d;
            this.timeout_at = Time.time + attr.timeout;
            //Debug.Log("WWW parm:" + url + "|" + str + "|" + headers);
            _www    = new Curl(url, body, headers);
            _reader = Start();
        }
Пример #6
0
 static public void Yield(uint msgid, CallAttr attr, ResponseDelegate d)
 {
     dispatchers[msgid] = new YieldContext {
         d = d, timeout_at = Time.time + attr.timeout
     };
 }
Пример #7
0
 void Dispatch(object[] req, CallAttr attr, uint msgid, ResponseDelegate d)
 {
     WriteStream(req);
     TransportManager.Yield(msgid, attr, d);
 }