Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System;
- public class EchoTest : MonoBehaviour
- {
- // Use this for initialization
- public IEnumerator StartSoket()
- {
- WebSocket w = new WebSocket(new Uri("ws://echo.websocket.org"));
- yield return StartCoroutine(w.Connect());
- w.SendString("Hi there");
- int i = 0;
- while (true)
- {
- string reply = w.RecvString();
- if (reply != null)
- {
- Debug.Log("Received: " + reply);
- w.SendString("Hi there" + i++);
- }
- if (w.Error != null)
- {
- Debug.LogError("Error: " + w.Error);
- break;
- }
- yield return 0;
- }
- w.Close();
- }
- public IEnumerator ConnectWebSocketsss()
- {
- Debug.LogError("Error: " );
- yield return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement