Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- // create a new websocket
- var socket = io.connect('http://localhost:8000');
- // on message received we print all the data inside the #container div
- socket.on('notification', function (data) {
- var usersList = "<dl>";
- $.each(data.users,function(index,user){
- usersList += "<dt>" + user.user_name + "</dt>n" +
- "<dd>" + user.user_description + "n" +
- "<figure> <img class='img-polaroid' width='50px' src='" + user.user_img + "' /></figure>"
- "</dd>";
- });
- usersList += "</dl>";
- $('#container').html(usersList);
- $('time').html('Last Update:' + data.time);
- });
- ws://localhost:8000/notification
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement