IRC Lite

The chat widget of the previous section can be easily extended to make a more realistic chat program. To do so, we’ll change the code for the chat widget to the following:

websockets/chat2.html
 
<script​ type=​"text/javascript"​ src=​"./jquery-1.7.1.min.js"​​>​​</script>
 
<script​ type=​"text/javascript"​ src=​"./websock.js"​​>​​</script>
 
<link​ rel=​"stylesheet"​ href=​"./chat1.css"​ type=​"text/css"​​>
 
 
<body>
 
<h2>​Chat​</h2>
 
<div​ id=​"idle"​​>
 
<input​ id=​"nick_input"​​/>
 
<button​ id=​"join"​​>​Join​</button>
 
<br​​/>
 
</div>
 
 
<div​ id=​"running"​​>
 
<table>
 
<tr>
 
<td>​​<div​ id=​"scroll"​​>​​</div>​​</td>
 
<td>​​<div​ id=​"users"​​>​​</div>​​</td>
 
</tr>
 
<tr>
 
<td​ colspan=​ ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.