Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b3f219e

Browse files
author
Rajeev Kumar Singh
committed
Readme
1 parent 150bccd commit b3f219e

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

‎Readme.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Spring Boot WebSocket Chat Appplication
2+
3+
You can checkout the live version of the application at https://spring-ws-chat.herokuapp.com/
4+
5+
## Requirements
6+
7+
1. Java - 1.8.x
8+
9+
2. Maven - 3.x.x
10+
11+
## Steps to Setup
12+
13+
1. Clone the application
14+
15+
```bash
16+
git clone git@github.com:callicoder/spring-boot-websocket-chat-demo.git
17+
```
18+
19+
2. Build and run the app using maven
20+
21+
```bash
22+
cd spring-boot-websocket-chat-demo
23+
mvn package
24+
java -jar target/websocket-demo-0.0.1-SNAPSHOT.jar
25+
```
26+
27+
Alternatively, you can run the app directly without packaging it like so -
28+
29+
```bash
30+
mvn spring-boot:run
31+
```
32+
33+
## Learn More
34+
35+
You can find the tutorial for this application on my blog -
36+
37+
https://www.callicoder.com/spring-boot-websocket-chat-example/

‎src/main/resources/static/js/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function onConnected() {
4040
// Tell your username to the server
4141
stompClient.send("/app/chat.addUser",
4242
{},
43-
JSON.stringify({sender: username, type: 'JOIN',timestamp: newDate().getTime()})
43+
JSON.stringify({sender: username, type: 'JOIN'})
4444
)
4545

4646
connectingElement.classList.add('hidden');
@@ -60,8 +60,7 @@ function sendMessage(event) {
6060
var chatMessage = {
6161
sender: username,
6262
content: messageInput.value,
63-
type: 'CHAT',
64-
timestamp: new Date().getTime()
63+
type: 'CHAT'
6564
};
6665

6766
stompClient.send("/app/chat.sendMessage", {}, JSON.stringify(chatMessage));

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /