const WebSocketServer = require('ws').Server,
      wss = new WebSocketServer({port: 8181});
      
wss.on('connection', (ws)=> {
  console.log('Client connected');
  ws.on('message', (message) => {
    console.log(message);
  });
});
@@ -93,16 +93,84 @@
 %0A      %0A
+var defaultMessages = %5B'Hello, world!', 'Test 1', 'Test 2'%5D;%0A      %0A
 wss.on('
@@ -226,16 +226,19 @@
 cted');%0A
+  %0A
   ws.on(
@@ -271,35 +271,365 @@
     
-console.log(m
+var request = JSON.parse(message);%0A    switch(request.type) %7B%0A      case 'fetchDefault':%0A        ws.send(JSON.stringify(defaultM
 essage
+s)
 );%0A  
-%7D);
+      break;%0A      case 'createMessage':%0A        wss.clients.forEach(function each(client) %7B%0A          var data = %5Brequest.data%5D;%0A          client.send(JSON.stringify(data));%0A        %7D);%0A        break;%0A    %7D%0A  %7D);%0A  
 %0A%7D);

Update server.js