Skip to content

Commit 8d860ea

Browse files
author
Gabriel Pulga
committed
projeto concluído
1 parent ae885d9 commit 8d860ea

File tree

9 files changed

+494
-5
lines changed

9 files changed

+494
-5
lines changed

pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
<artifactId>spring-boot-starter-test</artifactId>
2828
<scope>test</scope>
2929
</dependency>
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-amqp</artifactId>
33+
</dependency>
34+
35+
<dependency>
36+
<groupId>org.springframework.boot</groupId>
37+
<artifactId>spring-boot-starter-reactor-netty</artifactId>
38+
</dependency>
3039
</dependencies>
3140

3241
<build>

src/main/java/com/tupinamba/springbootwebsocket/config/WebSocketConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
1212

1313
@Override
1414
public void registerStompEndpoints(StompEndpointRegistry registry) {
15-
registry.addEndpoint("/javatechie").withSockJS();
15+
registry.addEndpoint("/websocket").withSockJS();
1616
}
1717

1818
@Override

src/main/java/com/tupinamba/springbootwebsocket/controller/ChatController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ public ChatMessage register(@Payload ChatMessage chatMessage, SimpMessageHeaderA
2222
public ChatMessage sendMessage(@Payload ChatMessage chatMessage) {
2323
return chatMessage;
2424
}
25-
2625
}

src/main/java/com/tupinamba/springbootwebsocket/model/ChatMessage.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.tupinamba.springbootwebsocket.model;
22

3-
public class ChatMessage {
43

4+
public class ChatMessage {
55
private String content;
66
private String sender;
77
private MessageType type;
@@ -33,5 +33,4 @@ public MessageType getType() {
3333
public void setType(MessageType type) {
3434
this.type = type;
3535
}
36-
3736
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
* {
2+
-webkit-box-sizing: border-box;
3+
-moz-box-sizing: border-box;
4+
box-sizing: border-box;
5+
}
6+
7+
html,body {
8+
height: 100%;
9+
overflow: hidden;
10+
}
11+
12+
body {
13+
margin: 0;
14+
padding: 0;
15+
font-weight: 400;
16+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
17+
font-size: 1rem;
18+
line-height: 1.58;
19+
color: #333;
20+
/* background-color: #f4f4f4; */
21+
height: 100%;
22+
23+
24+
25+
/* Center and scale the image nicely */
26+
background-position: center;
27+
background-repeat: no-repeat;
28+
background-size: cover;
29+
}
30+
31+
body:before {
32+
height: 50%;
33+
width: 100%;
34+
position: absolute;
35+
top: 0;
36+
left: 0;
37+
background: maxresdefault.jpg;
38+
content: "";
39+
z-index: 0;
40+
}
41+
42+
.clearfix:after {
43+
display: block;
44+
content: "";
45+
clear: both;
46+
}
47+
48+
.hidden {
49+
display: none;
50+
}
51+
52+
.form-control {
53+
width: 100%;
54+
min-height: 38px;
55+
font-size: 15px;
56+
border: 1px solid #c8c8c8;
57+
}
58+
59+
.form-group {
60+
margin-bottom: 15px;
61+
}
62+
63+
input {
64+
padding-left: 10px;
65+
outline: none;
66+
}
67+
68+
h1, h2, h3, h4, h5, h6 {
69+
margin-top: 20px;
70+
margin-bottom: 20px;
71+
}
72+
73+
h1 {
74+
font-size: 1.7em;
75+
}
76+
77+
a {
78+
color: #128ff2;
79+
}
80+
81+
button {
82+
box-shadow: none;
83+
border: 1px solid transparent;
84+
font-size: 14px;
85+
outline: none;
86+
line-height: 100%;
87+
white-space: nowrap;
88+
vertical-align: middle;
89+
padding: 0.6rem 1rem;
90+
border-radius: 2px;
91+
transition: all 0.2s ease-in-out;
92+
cursor: pointer;
93+
min-height: 38px;
94+
}
95+
96+
button.default {
97+
background-color: #e8e8e8;
98+
color: #333;
99+
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.12);
100+
}
101+
102+
button.primary {
103+
background-color: #25be38;
104+
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.12);
105+
color: #fff;
106+
}
107+
108+
button.accent {
109+
background-color: #1778dd;
110+
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.12);
111+
color: #fff;
112+
}
113+
114+
#username-page {
115+
text-align: center;
116+
}
117+
118+
.username-page-container {
119+
background: #fff;
120+
box-shadow: 0 1px 11px rgba(0, 0, 0, 0.27);
121+
border-radius: 2px;
122+
width: 100%;
123+
max-width: 500px;
124+
display: inline-block;
125+
margin-top: 42px;
126+
vertical-align: middle;
127+
position: relative;
128+
padding: 35px 55px 35px;
129+
min-height: 250px;
130+
position: absolute;
131+
top: 50%;
132+
left: 0;
133+
right: 0;
134+
margin: 0 auto;
135+
margin-top: -160px;
136+
}
137+
138+
.username-page-container .username-submit {
139+
margin-top: 10px;
140+
}
141+
142+
143+
#chat-page {
144+
position: relative;
145+
height: 100%;
146+
}
147+
148+
.chat-container {
149+
max-width: 700px;
150+
margin-left: auto;
151+
margin-right: auto;
152+
background-color: #fff;
153+
box-shadow: 0 1px 11px rgba(0, 0, 0, 0.27);
154+
margin-top: 30px;
155+
height: calc(100% - 60px);
156+
max-height: 600px;
157+
position: relative;
158+
}
159+
160+
#chat-page ul {
161+
list-style-type: none;
162+
background-color: #FFF;
163+
margin: 0;
164+
overflow: auto;
165+
overflow-y: scroll;
166+
padding: 0 20px 0px 20px;
167+
height: calc(100% - 150px);
168+
}
169+
170+
#chat-page #messageForm {
171+
padding: 20px;
172+
}
173+
174+
#chat-page ul li {
175+
line-height: 1.5rem;
176+
padding: 10px 20px;
177+
margin: 0;
178+
border-bottom: 1px solid #f4f4f4;
179+
}
180+
181+
#chat-page ul li p {
182+
margin: 0;
183+
}
184+
185+
#chat-page .event-message {
186+
width: 100%;
187+
text-align: center;
188+
clear: both;
189+
}
190+
191+
#chat-page .event-message p {
192+
color: #777;
193+
font-size: 14px;
194+
word-wrap: break-word;
195+
}
196+
197+
#chat-page .chat-message {
198+
padding-left: 68px;
199+
position: relative;
200+
}
201+
202+
#chat-page .chat-message i {
203+
position: absolute;
204+
width: 42px;
205+
height: 42px;
206+
overflow: hidden;
207+
left: 10px;
208+
display: inline-block;
209+
vertical-align: middle;
210+
font-size: 18px;
211+
line-height: 42px;
212+
color: #fff;
213+
text-align: center;
214+
border-radius: 50%;
215+
font-style: normal;
216+
text-transform: uppercase;
217+
}
218+
219+
#chat-page .chat-message span {
220+
color: #333;
221+
font-weight: 600;
222+
}
223+
224+
#chat-page .chat-message p {
225+
color: #43464b;
226+
}
227+
228+
#messageForm .input-group input {
229+
float: left;
230+
width: calc(100% - 85px);
231+
}
232+
233+
#messageForm .input-group button {
234+
float: left;
235+
width: 80px;
236+
height: 38px;
237+
margin-left: 5px;
238+
}
239+
240+
.chat-header {
241+
text-align: center;
242+
padding: 15px;
243+
border-bottom: 1px solid #ececec;
244+
}
245+
246+
.chat-header h2 {
247+
margin: 0;
248+
font-weight: 500;
249+
}
250+
251+
.connecting {
252+
padding-top: 5px;
253+
text-align: center;
254+
color: #777;
255+
position: absolute;
256+
top: 65px;
257+
width: 100%;
258+
}
259+
260+
261+
@media screen and (max-width: 730px) {
262+
263+
.chat-container {
264+
margin-left: 10px;
265+
margin-right: 10px;
266+
margin-top: 10px;
267+
}
268+
}
269+
270+
@media screen and (max-width: 480px) {
271+
.chat-container {
272+
height: calc(100% - 30px);
273+
}
274+
275+
.username-page-container {
276+
width: auto;
277+
margin-left: 15px;
278+
margin-right: 15px;
279+
padding: 25px;
280+
}
281+
282+
#chat-page ul {
283+
height: calc(100% - 120px);
284+
}
285+
286+
#messageForm .input-group button {
287+
width: 65px;
288+
}
289+
290+
#messageForm .input-group input {
291+
width: calc(100% - 70px);
292+
}
293+
294+
.chat-header {
295+
padding: 10px;
296+
}
297+
298+
.connecting {
299+
top: 60px;
300+
}
301+
302+
.chat-header h2 {
303+
font-size: 1.1em;
304+
}
305+
}

0 commit comments

Comments
 (0)