Skip to content

動態即時多人聊天室(可建立 / 加入房間),基於 node.js + Socket.io + Express。

License

Notifications You must be signed in to change notification settings

gw19/join-and-chat-in-multiple-rooms-with-socket-io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

join-and-chat

動態即時多人聊天室(可建立 / 加入房間),基於 node.js + Socket.io + Express。

version

join-and-chat

Introduction

join-and-chat 中,使用者登入並輸入暱稱之後會被預設加入「大廳」,並能與其他在同一個房間內的使用者對話。這個應用程式具有以下特徵:

  1. 使用者可以輸入系統指令:/join [room name] 來建立房間,如果房間已經存在則加入它。
  2. 除了 /join 指令之外,點選右方房間列表中的房間區塊也能直接加入。紅色背景的房間為您目前所在的房間,括號中為該房間內人數。
  3. 輸入指令 /ls 會刷新房間列表,系統每 30 秒刷新一次,如果使用者加入∕離開聊天實驗室或建立∕加入房間,所有人都會自動刷新列表。

Demo

https://join-and-chat.herokuapp.com/

How to use the code

必須先安裝 node.js
在命令提示字元進入專案的路徑後輸入:

npm install --save

它會為您安裝 package.json 中定義的相依模組,完成後輸入:

node server/server.js

這會啟動本地端伺服器,打開瀏覽器在網址輸入 localhost:3232 (port 可自行在程式碼中更改) and that's it!

License

MIT license.

Information

Author:  GW19  
如果您認為程式碼有任何需要改進的地方拜託告訴我,我會非常感謝您!