GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

src/front/js/sockets/index.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 2.5

Size

Lines of Code 40
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 0
wmc 5
c 2
b 0
f 0
nc 1
mnd 1
bc 5
fnc 2
dl 0
loc 40
rs 10
bpm 2.5
cpm 2.5
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A index.js ➔ ??? 0 3 1
1
const io = require('socket.io-client');
2
const isObject = require('is-it-object');
3
4
const app = require('./../app');
5
const counter = require('./../services/counter');
6
const renderJson = require('./../services/renderJson');
7
8
const socket = io.connect();
9
10
/**
11
 * Handler for WebSocket 'connect' event.
12
 * Emits 'join' event which is intended to join WebSocket room for current streamId.
13
 */
14
socket.on('connect', () => {
15
  socket.emit('join', app.getStreamId());
16
});
17
18
/**
19
 * Handler for new data.
20
 * Renders data on web page (add to the bottom).
21
 *
22
 * @event LOG.NEW
23
 */
24
socket.on('log', (data) => {
25
  if (isObject(data) === false) {
26
    return;
27
  }
28
29
  // It is only way to render proper data because socket.io rooms disabled here
30
  // @see https://github.com/cn007b/log/blob/master/src/back/routes/index.js:52
31
  if (data.streamId !== app.getStreamId()) {
32
    return;
33
  }
34
35
  if (data.format === 'json') {
36
    /** global: app */
37
    renderJson(data, app.getAutoScroll());
38
    counter.inc();
39
  }
40
});
41