I am trying to connect signalR from react-native app. If I open the connection, before registering proxy, connection happens. When I register proxy before the connection is opened, it fails the negotiation. If I register the proxy.on after connection. function is not being called. Please advise.
`import React, {Component} from 'react';
import {Text, StyleSheet, View} from 'react-native';
I am trying to connect signalR from react-native app. If I open the connection, before registering proxy, connection happens. When I register proxy before the connection is opened, it fails the negotiation. If I register the proxy.on after connection. function is not being called. Please advise.
`import React, {Component} from 'react'; import {Text, StyleSheet, View} from 'react-native';
import signalr from 'react-native-signalr';
export default class SignalTest extends Component { constructor(props) { super(props); } sendDriverUpdate = async => { this.connection .invoke('driverLocationUpdate', '2', '1.1221', '3.12312') .catch(err => console.error(err)); }; componentDidMount() { const connection = signalr.hubConnection('http://164.68.125.218', { headers: { token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImIiLCJuYmYiOjE1ODI4NzM2NDMsImV4cCI6MTU4NTQ2NTY0MywiaWF0IjoxNTgyODczNjQzLCJhdWQiOiIxNjQuNjguMTI1LjIxOCJ9.uRh1ExYW0y3RwYCOP6IetD_MEgkmyviwvW-_4iCQ_1k', username: 'b', driverid: 2, }, }); connection.logging = true;
}
render() { return (
} }
const styles = StyleSheet.create({}); `