title: How to setup unity with node.js hosted server using websocket?
body: <p>I am using unity + websocket + node js for a MMO game.
  I ran it in my local node js server and it ran successfully. But after uploading it in openshift I am featching some problem
  *** Websocket is connecting. But while sending through emit, it is not sending. Or I am unable to receive events from server.</p>
  
  <p>Here is my server code :</p>
  
  <pre><code>var ipaddress = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
  var port      = process.env.OPENSHIFT_NODEJS_PORT || 8080;
  
  var WebSocketServer = require('ws').Server
  var http = require('http');
  
  var server = http.createServer(function(request, response) {
      console.log((new Date()) + ' Received request for ' + request.url);
      response.writeHead(200, {'Content-Type': 'text/plain'});
        response.write("Welcome to Node.js on OpenShift!\n\n");
        response.end("Thanks for visiting us! \n");
  });
  
  server.listen( port, ipaddress, function() {
      console.log((new Date()) + ' Server is listening on port 8080');
  });
  
  wss = new WebSocketServer({
      server: server,
      autoAcceptConnections: false
  });
  
  
  wss.on('connection', function(ws) {
   console.log("Connection Success");
      var currentClient;
      var currentBot;
      var totalBot;
  
  
      ws.on('botenter', function (data) {
  
          console.log("Entered into botenter");
          currentBot = {
              position : data.position,  
          };
  
              ws.emit('BotMove', {
              position : currentBot.position,
  
          });
  
         console.log("Sending Success!!");
  
      });
  });
  
  console.log("Listening to " + ipaddress + ":" + port + "...");
  </code></pre>
  
  <p>And my Client code is:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using System.Collections.Generic;
  using SocketIO;
  using System.Text.RegularExpressions;
  using WebSocketSharp;
  
  public class Onclickground : MonoBehaviour {
  
  
      private SocketIOComponent socket;
      private Transform CurrentPilot;
      public GameObject Army;
      public GameObject Box;
      private float lastClick = 0;
      private float downTime;
      // Use this for initialization
      void Start () {
          //DontDestroyOnLoad(gameObject);
          GameObject go = GameObject.Find("SocketIO");
          socket = go.GetComponent&lt;SocketIOComponent&gt;();
          socket.On("BotMove", BotMove);
      }
  
      public void BotMove(SocketIOEvent e)
      {
  
          //Debug.Log("I am here!");
  
          SetItem(Army);
          //CurrentPilot.position = new Vector3(p.x, 0, p.z);
          //Vector3 r2 = new Vector3(p.x, 0, p.z);
          //Debug.Log(e.data[0].ToString());
          Vector3 newVector;
  
          string[] newS = e.data[0].ToString().Split( ',');
  
          // attempt to parse the value using the TryParse functionality of the integer type
          string bal = newS[0];
          int memeValue2 = IntParseFast(newS[2]);
          int memeValue1 = IntParseFast(bal);
          // attempt to parse the value using the TryParse functionality of the integer type
          //int.TryParse(newS[2], out memeValue2);
  
          //newVector = new Vector3(float.Parse(newS[0]), 0, float.Parse(newS[2]));
          //Vector3 r2 = new Vector3(p.x, 0, p.z);
  
          Debug.Log(memeValue1 + " |" + memeValue2);
          Debug.Log(newS[0] + " |" + newS[2]);
  
  
          CurrentPilot.position = new Vector3(memeValue1, 0, memeValue2); 
  
  
  
  
          float angle = Mathf.Atan2(CurrentPilot.position.x, CurrentPilot.position.z) * Mathf.Rad2Deg;
  
          CurrentPilot.Rotate(0, angle + 180, 0);
  
  
  
  
      }
  
      public static int IntParseFast(string value)
      {
          int result = 0;
          int i = 0;
          int neg=1;
          for (i = 0; i &lt; value.Length; i++)
          {
              char letter = value[i];
              if (letter == '.') break;
  
              if (value[i] == '-')
              {
                  neg = -1;
                  continue;
              }
  
              int disit = letter - 48;
              if(disit&lt;=9 &amp;&amp; disit&gt;=0) result = 10 * result + (letter - 48);
          }
          return result*neg;
      }
  
  
  
      // Update is called once per frame
      void Update () {
          Vector3 m = Input.mousePosition;
          m = new Vector3(m.x, m.y, transform.position.y);
          //Debug.Log(m.x);
          Vector3 p = GetComponent&lt;Camera&gt;().ScreenToWorldPoint(m);
  
          Vector3 r1 = new Vector3(0, 0, 0);
  
  
          if (Input.GetMouseButton(0) &amp;&amp; Time.time - lastClick &gt; 0.2)
          {
              lastClick = Time.time;
              Debug.Log("I am here!");
              //CurrentPilot.rotation = Quaternion.Euler(r3);
  
              Dictionary&lt;string, string&gt; data = new Dictionary&lt;string, string&gt;();
              data["position"] = p.x.ToString() + "," + 0.ToString() + "," + p.z.ToString();
              //socket.Emit("botenter", new JSONObject(data));
  
          }
      }
  
  
  
      void SetItem(GameObject b)
      {
          CurrentPilot = ((GameObject)Instantiate(b)).transform;
      }
  }
  </code></pre>