Java Server Sent Events Chat Example

zdsdqdqsfqdsfqdg
aaaa
mmmmmmmmm
aaaaaaaaaaaaa
anas
bla
xfgh
Hi
Hi
Hello
Awesome
dd
pippo
ff
gg
pp
hello
Hi
Whats upppppp
Ist es live?
htw?
cc
slt
htw
asfd
sdfasfas
hallo
hello
mnck
cvkcm
kk
jbm
this is mitac
1
2
3
4
5
6
555
678
3
56
fkjkjaslkjd
ñsmfñsmdñmfsd
sdlnsdn
sldnfknsd
ksdnflknsdklksdnfklsd
xc zxs s
dddddd
ssssssssssss
fweeppeep
jii
koo
hii prateek
whtsapp
12312
12--
ccssc
hello
asdas
efwq
ewq
asdsdas
saxasd
sad
d
sd
ds
zvc
zxcvxcv
aaa
dsa
dsa
hello
Hello Master
Hi Manjunath
hh
test
??
whats going on?
how would this work with IIS and C#?
bbbbjbjhb
jbbbmbbbmbmbkj k . bjbkbj
hello
hello
52
52
sdg
vn
452,
452,
hi everyone
may the java be with you
salut
ASDSDADAD
sfsx
cx
Elch
Was?

Enter message in the field above and press Enter to send it.

This is a simple Java Server Sent Events chat example. It illustrates usage of technology - how with a few lines of code you can achieve simple chat application working in a modern browsers.

Of course this simple example gives you only basics functionality. Further you can improve it. Also you can consider using this technology for other areas where it is required mostly one way communication. E.g. client is subscribed and listen to changes such as price change, status update, live scores, etc.

To test it open this page in two different browsers. Note that Internet Explorer does not support SSE. So use Google Chrome and Mozilla Firefox.

For more info you can read following article Introduction to SSE with PHP example or directly look into SSE PHP example that updates stock prices when market moves.

Download source code Download WAR file Read Java SSE article