All Projects → olofd → React Native Signalr

olofd / React Native Signalr

Use SignalR with React Native

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Signalr

Azure Signalr
Azure SignalR Service SDK for .NET
Stars: ✭ 137 (-2.84%)
Mutual labels:  websockets, signalr
Signalw
Even simpler and faster real-time web for ASP.NET Core.
Stars: ✭ 125 (-11.35%)
Mutual labels:  websockets, signalr
Sapphiredb
SapphireDb Server, a self-hosted, easy to use realtime database for Asp.Net Core and EF Core
Stars: ✭ 326 (+131.21%)
Mutual labels:  websockets, signalr
Websocket Nats
An in-browser websocket client for NATS, a lightweight, high-performance cloud native messaging system
Stars: ✭ 125 (-11.35%)
Mutual labels:  websockets
Sish
HTTP(S)/WS(S)/TCP Tunnels to localhost using only SSH.
Stars: ✭ 2,087 (+1380.14%)
Mutual labels:  websockets
Tacks
Real-time multiplayer sailing game, in your browser
Stars: ✭ 134 (-4.96%)
Mutual labels:  websockets
Forum
Zhejiang University CC98 Forum for desktop
Stars: ✭ 140 (-0.71%)
Mutual labels:  signalr
Tap Tap Adventure
Tap Tap Adventure is a massively online 2D MMORPG set in the medieval times with twists.
Stars: ✭ 123 (-12.77%)
Mutual labels:  websockets
Http
An opinionated framework for scalable web 🌎
Stars: ✭ 136 (-3.55%)
Mutual labels:  websockets
Rfc6455
I/O agnostic WebSocket Protocol
Stars: ✭ 133 (-5.67%)
Mutual labels:  websockets
Golive
⚡ Live views for GoLang with reactive HTML over WebSockets 🔌
Stars: ✭ 130 (-7.8%)
Mutual labels:  websockets
Huobi
火币的行情交易的python实现
Stars: ✭ 129 (-8.51%)
Mutual labels:  websockets
Bolt Js
A framework to build Slack apps using JavaScript
Stars: ✭ 1,971 (+1297.87%)
Mutual labels:  websockets
Osc Js
OSC library for Node.js, Electron, Chrome Apps, Webpages or any other JS application. It comes with a customizable Plugin API for WebSocket, UDP or bridge networking
Stars: ✭ 135 (-4.26%)
Mutual labels:  websockets
Tk Http
Full featured HTTP and Websockets library for rust/tokio
Stars: ✭ 132 (-6.38%)
Mutual labels:  websockets
Sente
Realtime web comms for Clojure/Script
Stars: ✭ 1,626 (+1053.19%)
Mutual labels:  websockets
Fs2 Http
Http Server and client using fs2
Stars: ✭ 132 (-6.38%)
Mutual labels:  websockets
Hprose Js
Hprose is a cross-language RPC. This project is Hprose 2.0 RPC for JavaScript
Stars: ✭ 133 (-5.67%)
Mutual labels:  websockets
Aspnetcore Angular Ngrx
🚀 An ASP.NET Core WebAPI Demo with an Angular Client using Ngrx store and effects and Signalr
Stars: ✭ 141 (+0%)
Mutual labels:  signalr
Graphqlws
Implementation of the GraphQL over WebSocket protocol in Go.
Stars: ✭ 139 (-1.42%)
Mutual labels:  websockets

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:

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} from 'react-native';
import signalr from 'react-native-signalr';

class AwesomeProject extends Component {

  componentDidMount() {
    //This is the server under /example/server published on azure.
    const connection = signalr.hubConnection('https://react-native-signalr.olofdahlbom.se');
    connection.logging = true;

    const proxy = connection.createHubProxy('chatHub');
    //receives broadcast messages from a hub function, called "helloApp"
    proxy.on('helloApp', (argOne, argTwo, argThree, argFour) => {
      console.log('message-from-server', argOne, argTwo, argThree, argFour);
      //Here I could response by calling something else on the server...
    });

    // atempt connection, and handle errors
    connection.start().done(() => {
      console.log('Now connected, connection ID=' + connection.id);

      proxy.invoke('helloServer', 'Hello Server, how are you?')
        .done((directResponse) => {
          console.log('direct-response-from-server', directResponse);
        }).fail(() => {
          console.warn('Something went wrong when calling server, it might not be up and running?')
        });

    }).fail(() => {
      console.log('Failed');
    });

    //connection-handling
    connection.connectionSlow(() => {
      console.log('We are currently experiencing difficulties with the connection.')
    });

    connection.error((error) => {
      const errorMessage = error.message;
      let detailedError = '';
      if (error.source && error.source._response) {
        detailedError = error.source._response;
      }
      if (detailedError === 'An SSL error has occurred and a secure connection to the server cannot be made.') {
        console.log('When using react-native-signalr on ios with http remember to enable http in App Transport Security https://github.com/olofd/react-native-signalr/issues/14')
      }
      console.debug('SignalR error: ' + errorMessage, detailedError)
    });
  }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].