1. Giới thiệu
Freechat là ứng dụng chat realtime chạy trên các nền tảng web và mobile (Android và iOS). Nó sử dụng ezyfox-server làm socket server và các client SDKs để phát triển các ứng dụng phía client. Bạn có thể dùng bản thử nghiệm tại đây, chỉ cần đăng nhập và hệ thống sẽ tự tạo tài khoản cho bạn.
2. Hỗ trợ đa nền tảng
Freechat hướng đến việc phụ vụ cho tất cả mọi người trên tất cả các nền tảng phổ biến hiện nay như:
- Website với ReactJS
- Android Java
- Android Kotlin
- iOS swift
Bạn có thể thoải mái clone source code từ Freechat và xây dựng ứng dụng chat cho riêng mình
3. Chạy bản Web
Với bản web sử dụng ReactJS, mọi việc khá đơn giản, bạn chỉ cần trải qua 3 bước:
Bước 1. Bạn có thể tải bản đầy đủ tại website hoặc clone source code từ github
Bước 2. Di chuyển đến thư mục
Bước 3. Chạy câu lệnh reactjsnpm start
Trình duyệt sẽ hiện mở ra 1 tab mới http://localhost:3000/login, hãy đăng nhập với tài khoản bất kì, và thế là xong
4. Android build
Để build được ra file apk cài đặt trên máy, chúng ta cần có:
- Android studio: 3.5
- Gradle: 3.5.0 or 5.4.1
- Android sdk: 26
Tiếp theo bạn cần một số bước để import dự án vào Android Studio:
Bước 1. Bạn có thể tải bản đầy đủ tại website hoặc clone source code từ github, nếu bạn clone source từ github, bạn sẽ cần di chuyển đế thư mục freechat vừa clone và chạy câu lệnh:
git submodule update --init --recursive
Để clone các client SDKs đi kèm.
Step 2. Import project vào
Step 3. Nhấn vào build và thế là xongAndroid studio
5. iOS build
Bước 1. Bạn có thể tải bản đầy đủ tại website hoặc clone source code từ github, nếu bạn clone source từ github, bạn sẽ cần di chuyển đế thư mục freechat vừa clone và chạy câu lệnh:
git submodule update --init --recursive
Để clone các client SDKs đi kèm.
Bước 2: Di chuyển đến thư mục, freechat/swift và chạy câu lệnh pod update để tải các thư viện đi kèm
Bước 3. Mở project `freechat-swift.xcworkspace trong thưc mục freechat/swift`
Bước 4. Build và chạy project, thế là xong
6. Chạy server local
Bước 1. Bạn có thể tải bản đầy đủ tại website hoặc clone source code từ github
Step 2. Import vào IDE của bạn (ví dụ Eclipse)freechat/server
Step 3. Download the EzyFox Full Edition
Step 4. Unzip it, let's say in Applications
Step 5. Build with mavenfreechat
Step 5.1 Build module:freechat
- Goals: clean install
Step 5.2 Build module:freechat-common
- Goals: clean install
- Profiles: export
- Environment: EZYFOX_SERVER_HOME = path_to_ezyfox_server
Step 5.3 Build module:freechat-plugin
- Goals: clean install
- Profiles: export
- Environment: EZYFOX_SERVER_HOME = path_to_ezyfox_server
Step 5.4 Build module:freechat-api
- Goals: clean install
- Profiles: export
- Environment: EZYFOX_SERVER_HOME = path_to_ezyfox_server
Step 5.5 Build module:freechat-entry
- Goals: clean install
- Profiles: export
- Environment: EZYFOX_SERVER_HOME = path_to_ezyfox_server
Step 6. Copy file: freechat/settings/freechat-zone-settings to folderezyfox-server/settings/zones
Step 7. Add this source code to `zones tag of ezyfox-server/settings/ezy-settings.xml` file:
<zone>
<name>freechat</name>
<config-file>freechat-zone-settings.xml</config-file>
<active>true</active>
</zone>
Step 8. After build and setup we have:
ezyfox-server/
+--settings/
| +--zones/
| | +--freechat-zone-settings.xml
| +--ezy-settings.xml
+--plugins/
| +--freechat-plugin/
| | +--freechat-plugin-1.0.0.jar
| | +--config/
| | +--config.properties
+--common/
| +--freechat-common-1.0.0.jar
+--apps/
| +--entries/
| | +--freechat/
| | +--config/
| | | +--questions.txt
| | | +--config.properties
| | +--freechat-entry-1.0.0.jar
| +--common/
| +--freechat-api-1.0.0.jar
Test Free Chat
Step 9. Install MongoDB and setup
port=27017
database=freechat
username=root
password=123456
Step 10. Start the EzyFox Server:
# On Windows, execute:
console.bat
# On other operating systems, execute:
./console.sh
Step 11. In file freechat/reactjs/src/socket/SocketProxy.js change 2 lines of function toconnect
// let url = "wss://ws.tvd12.com/ws";
let url = "ws://localhost:2208/ws";
Step 12. Install npm
Step 13. Move to and execute commands:freechat/reactjs
npm install
npm start
Step 14. After run the commands, we get the login page.
Step 15. Enter your username and click Login. Enjoy!