react-native-signalr
Connect to your SignalR-server with a active websocket-connection from react-native. Supports all error-handling and reconnection, including longpolling if needed.
Today the module shims the jQuery-dependency that signalr has. There is however an ongoing task upstream to remove this dependency.
Does NOT pull in the entire jQuery-library. Only shimes the few methods SignalR needs. Tested on iOS and Android. No known issues.
Install:
npm i react-native-signalr --save
There is an example server setup at https://react-native-signalr.olofdahlbom.se (Also a http version but you must disable App security transport on iOS for that, read in issues) (no webite, only responds to signalr) If it's up and running, you can use it to debug against. You can find the source for that server under examples/server. The code below uses that server to setup a connection and communicate over websockets using signalr.
Awesome-project:
;;; { //This is the server under /example/server published on azure. const connection = signalr; connectionlogging = true; const proxy = connection; //receives broadcast messages from a hub function, called "helloApp" proxy; // atempt connection, and handle errors connectionstart; //connection-handling connection; connection; } { return <View style=stylescontainer> <Text style=styleswelcome> Welcome to React Native! </Text> <Text style=stylesinstructions> To get started edit indexiosjs </Text> <Text style=stylesinstructions> Press Cmd+R to reload'\n' Cmd+D or shake for dev menu </Text> </View> ; } const styles = StyleSheet; AppRegistry;