Socket
Socket
Sign inDemoInstall

opentok-react-native

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentok-react-native - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

.npmignore

2

package.json
{
"name": "opentok-react-native",
"version": "0.6.3",
"version": "0.6.4",
"description": "React Native components for OpenTok iOS and Android SDKs",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -71,2 +71,21 @@ import { reassignEvents } from './OTHelper';

const getConnectionStatus = (connectionStatus) => {
switch(connectionStatus) {
case 0:
return "not connected";
case 1:
return "connected";
case 2:
return "connecting";
case 3:
return "reconnecting";
case 4:
return "disconnecting";
case 5:
return "failed";
}
};
const isConnected = (connectionStatus) => (getConnectionStatus(connectionStatus) === 'connected');
export {

@@ -76,2 +95,4 @@ sanitizeSessionEvents,

sanitizeCredentials,
getConnectionStatus,
isConnected,
};

@@ -8,2 +8,4 @@ import React, { Component } from 'react';

import OTPublisherView from './views/OTPublisherView';
import { isNull } from 'underscore';
import { isConnected } from './helpers/OTSessionHelper';

@@ -31,3 +33,3 @@ const uuid = require('uuid/v4');

componentDidMount() {
this.createPublisher();
this.createPublisher();
}

@@ -70,11 +72,5 @@ componentDidUpdate(previousProps) {

sessionConnectedHandler = () => {
OT.publish(this.state.publisherId, (publishError) => {
if (publishError) {
handleError(publisherError);
} else {
this.setState({
publisher: true,
});
}
});
if (isNull(this.state.publisher)) {
this.publish();
}
}

@@ -97,3 +93,19 @@ createPublisher() {

OT.initPublisher(this.state.publisherId, publisherProperties);
OT.getSessionInfo((session) => {
if (!isNull(session) && isNull(this.state.publisher) && isConnected(session.connectionStatus)) {
this.publish();
}
});
}
publish() {
OT.publish(this.state.publisherId, (publishError) => {
if (publishError) {
handleError(publishError);
} else {
this.setState({
publisher: true,
});
}
});
}
render() {

@@ -100,0 +112,0 @@ const { publisher, publisherId } = this.state;

@@ -5,6 +5,6 @@ import React, { Component, Children, cloneElement } from 'react';

import { setNativeEvents, removeNativeEvents, OT } from './OT';
import { sanitizeSessionEvents, sanitizeSignalData, sanitizeCredentials } from './helpers/OTSessionHelper';
import { sanitizeSessionEvents, sanitizeSignalData, sanitizeCredentials, getConnectionStatus } from './helpers/OTSessionHelper';
import { logOT } from './helpers/OTHelper';
import { handleError } from './OTError';
import { pick } from 'underscore';
import { pick, isNull } from 'underscore';

@@ -55,9 +55,12 @@ export default class OTSession extends Component {

} else {
OT.getSessionInfo((sessionInfo) => {
this.setState({
sessionInfo,
});
logOT(credentials.apiKey, credentials.sessionId, 'rn_on_connect', sessionInfo.connection.connectionId);
const signalData = sanitizeSignalData(this.props.signal);
OT.sendSignal(signalData, signalData.errorHandler);
OT.getSessionInfo((session) => {
if (!isNull(session)) {
const sessionInfo = { ...session, connectionStatus: getConnectionStatus(session.connectionStatus)};
this.setState({
sessionInfo,
});
logOT(credentials.apiKey, credentials.sessionId, 'rn_on_connect', session.connection.connectionId);
const signalData = sanitizeSignalData(this.props.signal);
OT.sendSignal(signalData, signalData.errorHandler);
}
});

@@ -64,0 +67,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc