XichChat consist of two parts: 1) XichIM Server and 2) XichChat Miniprogram Test
XichChat Miniprogram Test is a frontend sample.
XichIM Server is an lightweight server for chatting or instant messaging (IM).
Based on Spring boot. The protocol is implemented by plain WebSocket. Mysql 5.7 is used for persistent storage.
All API are implemented based on WebSocket. Before invoke the following method, connect the server using WebSocket at first.
{
command: "register",
parameters: ["username", "password"]
}
{
command: "login",
parameters: ["username", "password"]
}
{
command: "send",
parameters: ["message", "room-id"]
}
If the user is not in this room, this request will be treated as an attack. The user will be put in the blacklist.
{
command: "load",
parameters: ["room-id", "endTimestamp", "count"]
}
Lod history message
{
command: "createDirectMessage",
parameters: ["username-receiver"]
}
{
command: "roomList",
parameters: []
}
{
command: "markRead",
parameters: ["room-id"]
}
- Set up the database: import
db.sql
to your mysql server (version 5.7+) - Config the database connection in
application.properties
- Run on JDK 11+
TODO:
- Use Redis or other in-memory mapping solution to manage the state.
- Create room, join room, leave room...