Java Server Sent Events Chat Example

test
coco
valami
hey there
hello
fdgdfg
gfgdf
hi
hello
Bla
X
fdf
lg;
3543654
ertertrqe
gydgykd
hi
iqbal
IQM001
IQM005
wrt
123
888
wrt
test
j
j
hello
how are u
nnn
,l,l,l,l,l
,l,l,l,l,l
porcaccia la madonna
ñ{ñ
lmñlnmñk
.,nlknblkjbl
44
44
hey
whats up?


b
n
test
ii
pippppppppppppppppppppo
pippppppppppppppppppppo
pippppppppppppppppppppo
pippppppppppppppppppppo
pippppppppppppppppppppo
jjhj
cicccccc
ww
dd
hiii
rrrrrrrrrrr
kkkkkkk'
czxczxc
m;k;lh
tggdegf
Hi
Shalom
eeee
22222
qqqqq
2222
jhk
nnj
jk
jk
jk
jklkj
kjl
klj
ljk
jkl
jkljklhnlkjbh
jklj
jklj
ljk

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