// Start is called before the first frame update void Start() { // Make the normal client parseClient = new ParseClient( new ServerConnectionData { ApplicationID = "FILL ME IN!!!", ServerURI = "HTTP FILL ME IN .COM", Key = "ADD THIS TOO", // This is unnecessary if a value for MasterKey is specified. Headers = new Dictionary <string, string> { } }, new LateInitializedMutableServiceHub { }, new MetadataMutator { EnvironmentData = new EnvironmentData { OSVersion = SystemInfo.operatingSystem, Platform = $"Unity {Application.unityVersion} on {SystemInfo.operatingSystemFamily}", TimeZone = System.TimeZoneInfo.Local.StandardName }, HostManifestData = new HostManifestData { Name = Application.productName, Identifier = Application.productName, ShortVersion = Application.version, Version = Application.version } } , new AbsoluteCacheLocationMutator { CustomAbsoluteCacheFilePath = $"{Application.persistentDataPath.Replace('/', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}Parse.cache" } ); // Setup the instance parseClient.Publicize(); // Make the live client parseLiveClient = new ParseLiveQueryClient(new System.Uri($"wss://SOME LIVE SERVER")); //This is the URI to your live server // Lets listen to some events for the lifecycle of the Live Query parseLiveClient.OnConnected += ParseLiveClient_OnConnected; parseLiveClient.OnDisconnected += ParseLiveClient_OnDisconnected; parseLiveClient.OnLiveQueryError += ParseLiveClient_OnLiveQueryError; parseLiveClient.OnSocketException += ParseLiveClient_OnSocketException; // Setup the instance parseLiveClient.Publicize(); // Lets do a quick test to see how it all works AuthUser(); }
public void SetUp() { ParseObject.RegisterSubclass <ParseUser>(); ParseUser mockUser = ParseObject.Create <ParseUser>(); _subscriptionFactory = new TestSubscriptionFactory(); _currentUserController = Substitute.For <IParseCurrentUserController>(); _currentUserController.GetAsync(Arg.Any <CancellationToken>()).Returns(Task.FromResult(mockUser)); _currentUserController.GetCurrentSessionTokenAsync(Arg.Any <CancellationToken>()).Returns(Task.FromResult(mockUser.SessionToken)); ParseCorePlugins.Instance = new ParseCorePlugins { CurrentUserController = _currentUserController }; _parseLiveQueryClient = new ParseLiveQueryClient(new Uri("/", UriKind.Relative), (hostUri, callback) => { _webSocketClientCallback = callback; _webSocketClient = Substitute.For <IWebSocketClient>(); return(_webSocketClient); }, _subscriptionFactory, new ImmediateTaskQueue()); Reconnect(); }