signalr_socket

Last updated:

0 purchases

signalr_socket Image
signalr_socket Images
Add to Cart

Description:

signalr socket

signalr_socket #

A flutter plugin for aspx.net SignalR client for Android, iOS, macOS and Web
Getting Started #
Note: This library is NOT compatible with ASP.NET Core SignalR
Platform Support #



Android
iOS
macOS
Web
Windows
Linux




✔️
✔️
✔️
✔️





Add dependency #
dependencies:
signalr_socket: ^1.1.6 #latest version
copied to clipboard
Initialize SignalR Socket & connect to server.
SignalrSocket signalrSocket = SignalrSocket(
url: 'https://signalr.socket.com',
hubName: 'hubName',
eventName: 'eventName',
queryString: {'key': 'value'},
updateConnectionStatus: (status) {
debugPrint("signalr socket update connection status ${status.name}");
},
newMessage: (message) {
debugPrint("signalr socket new message $message");
},
);

signalrSocket.connect();
copied to clipboard
Android Setup #

Add proguard rules for release mode in android
Create a new file in your android project: android/app/proguard-rules.pro
Add the following lines to the proguard-rules.pro

-keep class com.github.signalr4j.client.hubs.HubResult { *; }
-keep class com.github.signalr4j.client.hubs.HubInvocation { *; }
-keep class com.github.signalr4j.client.hubs.HubProxy$* { *; }
-keep class com.github.signalr4j.client.hubs.HubConnection {*;}
copied to clipboard
If you want a HTTP url, then you need to add the following lines to the manifest of your android project.
<application
android:usesCleartextTraffic="true">
</application>
copied to clipboard
Web Setup #

Add some js files to your web project in 'web/signalR_js'
Download javascript files here https://github.com/ARASHz4/flutter_signalR_js/archive/refs/tags/2.4.3.zip
Add 3 files 'jquery.min.js', 'jquery.signalR-2.4.3.min.js' and 'socketConnection.js' in 'web/signalR_js' folder
Go to 'web/index.html' and add the following lines in head

<head>
<!--other lines-->

<script defer type="application/javascript" src="signalR_js/jquery.min.js"></script>
<script defer type="application/javascript" src="signalR_js/jquery.signalR-2.4.3.min.js"></script>
<script defer type="application/javascript" src="signalR_js/socketConnection.js"></script>
</head>
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.