2017-09-27 97 views
-1

我在Angular的Tic Tac Toe游戏上工作,我发现这个游戏已经内置的github repo,它工作的很好。运行npm installnpm start后,如果我在浏览器上访问此网址localhost:8080,游戏将开始。角的tic tac toe游戏

https://github.com/siddhartha-gupta/angular2-tic-tac-toe 

现在我是想明白这个游戏是如何工作的以及它的逻辑和我被困在这条线在server-communicator.service.ts类:

https://github.com/siddhartha-gupta/angular2-tic-tac-toe/blob/master/app/ts/services/server-communicator.service.ts#L20 

下面是代码:

initSocket(callback: Function) { 
    // this.socket = io.connect('https://tic-tac-toe-881512.herokuapp.com'); 
    this.socket = io.connect('http://localhost:5000'); 
    this.msgReceiver(); 
    callback(); 
} 

我不确定我们在localhost port 5000上运行什么?我可以看到我们正在打开一个到localhost:5000的套接字,但不知道这是什么目的?任何人都可以解释我们在做什么localhost port 5000

回答