Apply prettier formating
[e-mobility-charging-stations-simulator.git] / test / robohydra / plugins / wsServer / index.js
index d4ab6b8dfad79f4f1bb319265d0a59171b0913d0..485ee19ef720ce29fad8f5006b6e84588fba2514 100644 (file)
@@ -2,7 +2,7 @@ const RoboHydraHead = require('robohydra').heads.RoboHydraHead;
 const RoboHydraWebSocketHead = require('robohydra').heads.RoboHydraWebSocketHead;
 const RoboHydraWebSocketHeadProxy = require('robohydra').heads.RoboHydraWebSocketHeadProxy;
 
-exports.getBodyParts = function(conf) {
+exports.getBodyParts = function (conf) {
   let wsSocket;
   return {
     heads: [
@@ -10,7 +10,7 @@ exports.getBodyParts = function(conf) {
         name: 'message',
         path: '/message',
         method: 'POST',
-        handler: function(req, res) {
+        handler: function (req, res) {
           const msg = JSON.stringify(req.body);
           if (wsSocket) {
             wsSocket.send(msg);
@@ -18,42 +18,42 @@ exports.getBodyParts = function(conf) {
           } else {
             res.send('Cannot send message, no opened websocket found');
           }
-        }
+        },
       }),
 
       new RoboHydraHead({
         name: 'close',
         path: '/close',
         method: 'GET',
-        handler: function(req, res) {
+        handler: function (req, res) {
           if (wsSocket) {
             wsSocket.close();
             res.send('Websocket closed');
           } else {
             res.send('Cannot close websocket, no opened websocket found');
           }
-        }
+        },
       }),
 
       new RoboHydraWebSocketHeadProxy({
         name: 'proxy',
         mountPath: '/proxy',
         proxyTo: 'ws://server.example.com',
-        preProcessor: function(data) {
+        preProcessor: function (data) {
           console.log('From the client: ' + data);
         },
-        postProcessor: function(data) {
+        postProcessor: function (data) {
           console.log('From the server: ' + data);
-        }
+        },
       }),
 
       new RoboHydraWebSocketHead({
         name: 'WS Server',
         path: '/.*',
-        handler: function(req, socket) {
+        handler: function (req, socket) {
           wsSocket = socket;
-        }
-      })
-    ]
+        },
+      }),
+    ],
   };
 };