示例#1
0
    public void Connect(bool isRemote)
    {
        UriBuilder builder;

        if (isRemote)
        {
            builder = new UriBuilder()
            {
                Scheme = "wss",
                Host   = "tylrpage.com",
                Port   = Constants.GAME_PORT
            };
        }
        else
        {
            builder = new UriBuilder()
            {
                Scheme = "ws",
                Host   = "localhost",
                Port   = Constants.GAME_PORT
            };
        }
        Debug.Log("Connecting to " + builder.Uri);
        _ws.Connect(builder.Uri);
    }
示例#2
0
    public void Connect()
    {
        // connect
        UriBuilder uriBuilder = new UriBuilder()
        {
            Scheme = "wss",
            Host   = "tylrpage.com",
            Port   = Constants.GAME_PORT
        };

        _webClient.Connect(uriBuilder.Uri);
    }
示例#3
0
        private void Connect()
        {
            var tcpConfig = new TcpConfig(true, 5000, 5000);

            client = SimpleWebClient.Create(32000, 500, tcpConfig);

            client.onConnect    += () => Debug.Log($"Connected to Server");
            client.onDisconnect += () => Debug.Log($"Disconnected from Server");
            client.onData       += OnData;
            client.onError      += (exception) => Debug.Log($"Error because of Server, Error:{exception}");

            client.Connect(new Uri("ws://localhost:7776"));
        }