Permalink
Browse files

Log error message when there are zero connected clients

Reviewed By: frantic

Differential Revision: D5789198

fbshipit-source-id: 0c927fe7efc204b7f1173da97cc69262867e632b
  • Loading branch information...
hrp authored and facebook-github-bot committed Sep 8, 2017
1 parent ae60ae4 commit c88b2b2c659ec00148eea13a9f9ff235ba8c9cf1
Showing with 9 additions and 0 deletions.
  1. +9 −0 local-cli/server/util/messageSocket.js
@@ -11,6 +11,7 @@
const url = require('url');
const WebSocketServer = require('ws').Server;
const PROTOCOL_VERSION = 2;
const notifier = require('node-notifier');
function parseMessage(data, binary) {
if (binary) {
@@ -76,6 +77,14 @@ function attachToServer(server, path) {
method: message.method,
params: message.params,
};
if (clients.size === 0) {
notifier.notify({
'title': 'React Native: No apps connected',
'message': `Sending '${message.method}' to all React Native apps ` +
'failed. Make sure your app is running in the simulator ' +
'or on a phone connected via USB.'
});
}
for (const [otherId, otherWs] of clients) {
if (otherId !== broadcasterId) {
try {

0 comments on commit c88b2b2

Please sign in to comment.