public HttpEndPoint(string endPoint, EndPointOptions options) : base(endPoint, options) { if (options.Key != null) { _hmac = Hmac.Sha1(options.Key); } }
// token for the websocket public WebSocketEndPoint(string endPoint, EndPointOptions options) : base(MakeHttpEndpoint(endPoint), options) { _wsUrl = new EB.Uri(endPoint); _socket = new Net.TalkWebSocket(); _socket.ActivityTimeout = options.ActivityTimeout; _socket.OnError += OnError; if (options.KeepAlive) { ConnectIfNeeded(); } }
public override void Connect() { State = SubSystemState.Connected; string portraitId = EB.Dot.String("portraitId", Hub.Instance.DataStore.LoginDataStore.LoginData, ""); if (portraitId != "") { SetPortrait(Hub.Instance.DataStore.LoginDataStore.LocalUserId.Value, portraitId, PortraitPriority.High); } EB.Sparx.Config config = SparxHub.Instance.Config; EndPointOptions options = new EndPointOptions { Key = config.ApiKey.Value }; Hashtable social = EB.Dot.Object("social", Hub.Instance.DataStore.LoginDataStore.LoginData, null); if (null == social) { return; } string endpointUrl = EB.Dot.String("endpoint", social, null); _imageBaseUrl = EB.Dot.String("imageBase", social, null);; _socialEndPoint = EndPointFactory.Create(endpointUrl, options); _socialEndPoint.AddData("stoken", Hub.Instance.ApiEndPoint.GetData("stoken")); _api.SetSocialEndpoint(_socialEndPoint); _allowPullFriendsPortraitInfoUntil = new DateTimeRef(System.DateTime.Now); _allowPullAdHocPortraitInfoUntil = new DateTimeRef(System.DateTime.Now); UpdateUniqueTimestamp(); GetFriendsPortraitInfo(null); Hub.Instance.GetManager <PushManager>().OnDisconnected += OnPushDisconnected; }
void Initialize(Config config) { Config = config; DataStore = new DataStore(); BugReport.Init(config.ApiEndpoint + "/bugs"); Assets.LoadAsync("profanity", typeof(TextAsset), o => { TextAsset profanity = o as TextAsset; if (profanity != null) { ProfanityFilter.Init(profanity.text); Assets.Unload("profanity"); } }); var options = new EndPointOptions { Key = config.ApiKey.Value }; if (config.ApiKeepAlive > 0) { options.KeepAlive = true; options.KeepAliveUrl = "/util/ping"; options.KeepAliveInterval = config.ApiKeepAlive; } ApiEndPoint = EndPointFactory.Create(config.ApiEndpoint, options); EB.Memory.OnBreach += delegate() { FatalError("ID_SPARX_ERROR_UNKNOWN"); }; InitializeComponents(); }
public EndPointSimulator(string endPoint, EndPointOptions options) : base(endPoint, options) { }