chat.md name: チャットルーム

sort: 1

チャットルーム

このサンプルでは、Web IMアプリケーションを実装する2つの方法を示しています:

ロングポーリングを使用しています。 WebSocketを使用しています。

どちらもデフォルトではメモリにデータを保存していますので、毎回やり直してスタートしますが、データベースを使用するためにconf/app.conf内で設定を変更することができます。

プロジェクト構造は、次のとおりです:

  1. WebIM/
  2. WebIM.go # File of main package
  3. conf
  4. app.conf # Configuration file
  5. controllers
  6. app.go # The welcome screen that allows user to pick a technology and username
  7. chatroom.go # Functions for data management
  8. longpolling.go # Controller and methods for long polling chat demo
  9. websocket.go # Controller and methods for WebSocket chat demo
  10. models
  11. archive.go # Functions of chat data operations for both demos.
  12. views
  13. ... # Template files
  14. static
  15. ... # JavaScript and CSS files

GitHub上でコードを見る