-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.js
33 lines (24 loc) · 1012 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @format
*/
import 'react-native-gesture-handler';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import socketClient from './helpers/socket';
import {getUserId, isLoggedIn} from './helpers/auth-header';
import {socketMessageListener} from './helpers/notification';
const MyHeadlessTask = async () => {
const loginStatus = isLoggedIn();
if (!loginStatus) return;
console.log('socketClient.isConnected()', socketClient.isConnected());
let isConnected = socketClient.isConnected();
const userId = getUserId();
if (!isConnected) socketClient.connect();
// console.log(socketClient.hasListenerRegistered('user_message'));
// if (socketClient.hasListenerRegistered('user_message')) return;
// socketClient.joinRoomByUserId(userId);
// socketClient.listenEventForMessage(socketMessageListener);
};
AppRegistry.registerHeadlessTask('Heartbeat', () => MyHeadlessTask);
AppRegistry.registerComponent(appName, () => App);