This repo exists as an archived reference only. We are no longer taking changes or updating the code in this repo.
aspnet / signalr-samples Goto Github PK
View Code? Open in Web Editor NEWSamples for ASP.NET Core SignalR
Samples for ASP.NET Core SignalR
This repo exists as an archived reference only. We are no longer taking changes or updating the code in this repo.
Exception Details
java.lang.ClassNotFoundException: Didn't find class "java.time.Duration" on path: DexPathList[[zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/base.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.microsoft.signalr.HubConnection.(HubConnection.java:50)
at com.microsoft.signalr.HttpHubConnectionBuilder.build(HttpHubConnectionBuilder.java:64)
at com.microsoft.aspnet.signalr.samples.androidjavaclient.MainActivity.onCreate(MainActivity.java:27)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.microsoft.aspnet.signalr.samples.androidjavaclient-1/split_lib_slice_5_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:295)
at dalvik.system.DexFile.(DexFile.java:80)
at dalvik.system.DexFile.(DexFile.java:59)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:279)
at dalvik.system.DexPathList.makePathElements(DexPathList.java:248)
at dalvik.system.DexPathList.(DexPathList.java:120)
at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.(PathClassLoader.java:65)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:84)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:45)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:434)
at android.app.LoadedApk.makeApplication(LoadedApk.java:659)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6289)
On Android api below 26 we are unable to run signalr client
ChatSample works, but if I update Microsoft.AspNetCore.All from preview1 to preview2, it doesn't work. So, could you provide an example using preview2?
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1590,2): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Perhaps it doesn't exist in the Mono for Android profile?
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1590,2): error : File name: 'System.Memory.dll'
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1590,2): error : at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1590,2): error : at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1590,2): error : at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver)
We now have a Samples repo. Moving these SignalR samples there might make them more discoverable.
Hi, The UWP sample will throw exception "The certificate authority is invalid or incorrect".
Could you please update and fix this issue?
I am facing below error at hubConnection.on("ReceiveMessage",..):
java.lang.NoClassDefFoundError: com.microsoft.aspnet.signalr.-$$Lambda$CallbackMap$V5Uq2tEgd64-ZwWFXygwi8ZeV4I
dependency
implementation 'com.microsoft.aspnet:signalr:0.1.0-preview1-35029'
here throwing that error
hubConnection.on("ReceiveMessage", (message)-> {
getActivity().runOnUiThread(new Runnable() { @Override public void run() { Log.d("MessageReceived",message); arrayAdapter.add(senderName + " : " +message); arrayAdapter.notifyDataSetChanged(); } }); }, String.class);
Find below error source
**10-07 23:24:39.425 18779-18779/com.cabieo.cabieoapp I/art: Rejecting re-init on previously-failed class java.lang.Class<com.microsoft.aspnet.signalr.-$$Lambda$CallbackMap$V5Uq2tEgd64-ZwWFXygwi8ZeV4I>
10-07 23:24:39.425 18779-18779/com.cabieo.cabieoapp D/AndroidRuntime: Shutting down VM
--------- beginning of crash
10-07 23:24:39.600 18779-18779/com.cabieo.cabieoapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.cabieo.cabieoapp, PID: 18779
java.lang.NoClassDefFoundError: com.microsoft.aspnet.signalr.-$$Lambda$CallbackMap$V5Uq2tEgd64-ZwWFXygwi8ZeV4I
at com.microsoft.aspnet.signalr.CallbackMap.put(CallbackMap.java:15)
at com.microsoft.aspnet.signalr.HubConnection.on(HubConnection.java:219)
at com.cabieo.cabieoapp.Fragments.ChatHomeFragment.onCreateView(ChatHomeFragment.java:70)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
at android.os.Handler.handleCallback(Handler.java:742)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5571)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
10-07 23:24:39.607 5240-5310/? I/octvm_klo: klo lock**
Hello to all. Please help solve problem. I've issue with calling OnDisconnectedAsync method when IPad wi-fi turned off, calling may be happen fast but some times it takes a long time more 10 minutes, but some times never. I need a stable disconnect calling for example 30 seconds. I use signalR 1.1.0 with default KeepAliveInterval and ServerTimeout. How I can manage this?
I hope I don't have to do a manual check of the client to disconnect. It'll be terrible:(
Thx for help.
Right now it seems like transport fallback isn't working. Ran into this when publishing an app to Antares with Websockets disabled.
I have a signalr implementation of a server which allows users to connect to multiple groups. I am using the WPF .NET signalr client to connect and have noticed, very regularly, that if the client closes the application abruptly, with invoking disconnect, the server signalr group keeps waiting on rude send method. This can be replicated easily by creating a high throughout server using Groups and the call hangs on
await _hunContext.Clients.Group(groups).SendMsg(msg).
I will appreciate any help since I haven’t noticed any samples which utilizes groups.
06-11 08:55:03.470 14490-2778/com.tatweer.vehicledashboardapp.dev E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com.tatweer.vehicledashboardapp.dev, PID: 14490
java.lang.StackOverflowError: stack size 1038KB
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(SingleFlatMapCompletable.java:102)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onComplete(Single
android 6
retrofitVersion = '2.3.0'
rxVersion = '2.1.1'
rxAndroidVersion = '2.0.2'
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersion"
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidVersion"
implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
Can i use bare js EventSource() Sever Sent Event, to connect signalr hub ?
If not , how to use sse with signalr ?
Using Windows 7, latest Chrome, latest SDK; preview-2
Pulled it down via github, ran as is. However, "url" should be replaced with "/chat" in index.html.
(index):55 Uncaught TypeError: Cannot read property 'invoke' of undefined
at HTMLInputElement. ((index):55)
at line
connection.invoke('send', name, messageInput.value);
if for this samples,error is follow:
System.Net.WebSockets.WebSocketException: The 'Sec-WebSocket-Accept' header value 'TTADvdCKZ4RHl0ek4ZWlOMVlq0I=' is invalid.
if add .WithTransport(Microsoft.AspNetCore.Sockets.TransportType.LongPolling), then error is follow:
System.Net.Http.HttpRequestException: 500 (Internal Server Error)
if add .WithTransport(Microsoft.AspNetCore.Sockets.TransportType.ServerSentEvents), then error is follow:
System.Threading.Tasks.TaskCanceledException: A task was canceled.
if add .WithTransport(Microsoft.AspNetCore.Sockets.TransportType.ServerSentEvents), then error is follow:
if add WebSockets then error is follow:
System.Net.WebSockets.WebSocketException: The 'Sec-WebSocket-Accept' header value 'M4b91cosiaTsNqwMqG1/Pv7WICw=' is invalid.
I have a react website in which I am trying to connect to SignalR hub on my .net core server via ocelot gateway.
I am unable to connect to hub and get a 404 error "No Connection with that ID". I have only one server instance running and no load balancer is involved.
Even though the negotiate call is always successful.
WebSocket and Server Sent Events are not working at all and on Long Polling, 404 is returned.
I have added all possible routes for ocelot. I am out of ideas on what to do now.
I have observed that the connectionId returned in response to the negotiate call is not used to connect to hub and instead the connectionToken value is used as the value for "id" query string parameter.
connection.start()
.then(function (connection) {
console.log(connection);
connection started, ok. but after that
here connection is undefined and of course all other not work
line 98.
onClose.invoke(null, t.getMessage());
Should be changed to onClose.accept(0, t.getMessage());
Otherwise a NullPointerException is reported when the network state changes.
Hi All,
ChatSample is working fine on my machine but the only thing is when I am trying to refer full url i.e "http://localhost:64654/chat" then I am getting error. The error says "Connection ID required" so is it a bug or I am not doing something wrong.Help me out
Should be able to send messages with the enter key
Previously I was using .Net Core 2.2, I was able to send a json object from a service class using hub context and SendAsync method to a front end web client. Im having issues after I've upgraded my project framework to 3.1. If i call the SendAsync method using a json object, it will hit an error stating "{"The collection type 'Newtonsoft.Json.Linq.JObject' is not supported."}", if I send any other class object it will directly go to OnDisconnected.
Sample of the method i use
Using Json Object: await _hubContext.Clients.Group(groupName).SendAsync("NotificationResponse", jsonObject);
Using Class Object: await _hubContext.Clients.Group(groupName).SendAsync("NotificationResponse", notificationObject);
I've tried sending object directly from the hub, I was able to send a normal class object but not a json object. I did the testing on my project and also sample from this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/signalr?view=aspnetcore-3.1&tabs=visual-studio
would please add bearer token authentication sample
I received error:
WebSocket connection to 'ws://localhost:2052/chat?id=cac62362-90af-49e9-ad97-59eecaadfee8' failed: Error during WebSocket handshake: Unexpected response code: 204
There's currently an Android project with gradle that uses the Java client but I think we should also include a simple Java console application the uses Maven.
Hi,
That's hard to read, and the client SingalR code is a new thing. It could be benefit for both developers and people writing the sample code to move it outside of the html markup.
Just like in this sample which already uses external script:
https://github.com/aspnet/SignalR-samples/tree/master/StockTickR/StockTickRApp
Thanks!
The sample should be using the 1.0 Jar
implementation 'com.microsoft.signalr:signalr:1.0.0'
I can run the StockTickRApp and connect the NodeClient and see stock prices written to the console. When I connect the CSharpClient it does not write anything to the console.
From debugging I suspect this section:
var state = await connection.InvokeAsync<string>("GetMarketState");
if (string.Equals(state, "Open"))
The call to GetMarketState returns "Closed" so the StartStreaming method is never called.
I want to send SMS if the user is not online,is there a way to confirm that users are online through IHubContext?Or do I deal with it myself?
It would help newbies to tell them to edit the launchSettings.json file to set the port to 5000 to get this sample to run.
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5000/",
"sslPort": 0
}
hi
can anybody help me for get message in background when app is closed??????
i work with services but not work for me!
When I try to use your sample code and start hubConnection in AsynTask send method works but on method does not work.
public class ChatActivity extends BaseActivity {
public HubConnection hubConnection;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
String bearerToken = localStorage.getString("KEY_AUTHORIZATION_TOKEN");
hubConnection = HubConnectionBuilder.create("https://....")
.withHeader("Authorization", bearerToken)
.build();
hubConnection.on("DeletedChat", chatModel -> {
EventBus.getDefault().post(new DeletedChatEvent(chatModel));
}, ChatModel.class);
hubConnection.on("NewChat", chatModel -> {
EventBus.getDefault().post(new NewChatEvent(chatModel));
}, ChatModel.class);
hubConnection.on("NewMessage", chatMessageModel -> {
EventBus.getDefault().post(new NewMessageEvent(chatMessageModel));
}, ChatMessageModel.class);
hubConnection.on("ReadedMessages", chatMessageModels -> {
EventBus.getDefault().post(new ReadedMessagesEvent(chatMessageModels));
}, ChatMessageModel[].class);
new HubConnectionTask().execute(hubConnection);
}
public void sendMessage(ChatModel chatModel){
hubConnection.send("SendMessage", chatModel);
}
class HubConnectionTask extends AsyncTask<HubConnection, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(HubConnection... hubConnections) {
HubConnection hubConnection = hubConnections[0];
hubConnection.start().blockingAwait();
return null;
}
}
}
If I try to connect hubConnection in onCreate() without AsyncTask as below everything work fine but .blockingAwait() is blocking main thread and activity does not open for a while.
public class ChatActivity extends BaseActivity {
public HubConnection hubConnection;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
String bearerToken = localStorage.getString("KEY_AUTHORIZATION_TOKEN");
hubConnection = HubConnectionBuilder.create("https://...")
.withHeader("Authorization", bearerToken)
.build();
hubConnection.on("DeletedChat", chatModel -> {
EventBus.getDefault().post(new DeletedChatEvent(chatModel));
}, ChatModel.class);
hubConnection.on("NewChat", chatModel -> {
EventBus.getDefault().post(new NewChatEvent(chatModel));
}, ChatModel.class);
hubConnection.on("NewMessage", chatMessageModel -> {
EventBus.getDefault().post(new NewMessageEvent(chatMessageModel));
}, ChatMessageModel.class);
hubConnection.on("ReadedMessages", chatMessageModels -> {
EventBus.getDefault().post(new ReadedMessagesEvent(chatMessageModels));
}, ChatMessageModel[].class);
hubConnection.start().blockingAwait();
}
public void sendMessage(ChatModel chatModel){
hubConnection.send("SendMessage", chatModel);
}
}
If I trying to connection just with hubConnection.start(); , send methods work but on methods not working again.
public class ChatActivity extends BaseActivity {
public HubConnection hubConnection;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
String bearerToken = localStorage.getString("KEY_AUTHORIZATION_TOKEN");
hubConnection = HubConnectionBuilder.create("https://...")
.withHeader("Authorization", bearerToken)
.build();
hubConnection.on("DeletedChat", chatModel -> {
EventBus.getDefault().post(new DeletedChatEvent(chatModel));
}, ChatModel.class);
hubConnection.on("NewChat", chatModel -> {
EventBus.getDefault().post(new NewChatEvent(chatModel));
}, ChatModel.class);
hubConnection.on("NewMessage", chatMessageModel -> {
EventBus.getDefault().post(new NewMessageEvent(chatMessageModel));
}, ChatMessageModel.class);
hubConnection.on("ReadedMessages", chatMessageModels -> {
EventBus.getDefault().post(new ReadedMessagesEvent(chatMessageModels));
}, ChatMessageModel[].class);
hubConnection.start();
}
public void sendMessage(ChatModel chatModel){
hubConnection.send("SendMessage", chatModel);
}
}
How can we start activity and make the on methods work without locking the main thread?
unable to get this client to work.
https://github.com/foxjazz/WebAdmsClient/issues
I want to run a SignalR .NET Core server without an ASP.NET website backing it (like the self-host examples of the old SignalR).
It'd be nice to see an example here of how to do this?
I created a basic example based on the sample , however it does not work
const signalR = require("@aspnet/signalr");
XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
WebSocket = require("websocket").w3cwebsocket;
let connection = new signalR.HubConnectionBuilder()
.withUrl("http://localhost:61937/signalr/hubs")
.build();
connection.on("send", data => {
console.log(data);
});
connection.start()
.then(() => connection.invoke("send", "Hello"));
error -
module.js:549
throw err;
^
Error: Cannot find module 'tslib'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (..../signarlclient/node_modules/@aspnet/signalr/dist/cjs/Errors.js:5:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
node environment
node -v
v10.8.0
npm -v
6.2.0
packages installed
"dependencies": {
"@aspnet/signalr": "^1.0.3",
"@types/node": "^10.9.4",
"eventsource": "^1.0.7",
"websocket": "^1.0.26",
"xmlhttprequest": "^1.8.0"
}
Hi, I am trying to persist the log from the chat, Is there a marker or cursor, how can we persist the chat log its and its sequnece in sql serve, can you update the sample
I am looking for SignalR server side code sample for the Xamrin sample below:
https://github.com/aspnet/SignalR-samples/tree/master/Xamarin
How to fix the below error from hubConnection.start().blockingAwait();
Caused by: java.lang.RuntimeException: There were no compatible transports on the server.
at com.microsoft.signalr.HubConnection.lambda$startNegotiate$11(HubConnection.java:364)
at com.microsoft.signalr.-$$Lambda$HubConnection$GiLlPVdlbvryuPaYB9UmGffcsYc.apply(Unknown Source:8)
at io.reactivex.internal.operators.single.SingleFlatMap$SingleFlatMapCallback.onSuccess(SingleFlatMap.java:76)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
at io.reactivex.subjects.SingleSubject.onSuccess(SingleSubject.java:141)
at com.microsoft.signalr.DefaultHttpClient$2.onResponse(DefaultHttpClient.java:124)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
On Monday, 15 March (slightly delayed, sorry), we renamed the default branch in this repository to main. For more details, see our earlier announcement.
Hi All,
I created a quick and simple sample:
https://github.com/h5aaimtron/SignalRCoreWithAuth
In the event you want to add/copy/etc. it to the existing SignalR Core samples. I'm going to add an Angular 6+ client and commit this weekend. I'm certain that my sample is not perfect, but it generally functions.
-Scott
How to do it
Can someone share a project example of a MVC web application implementing real-time database notification with using ASP.NET Core 3.0 or 3.1, ADO.NET, SignalR 3.0 and SqlDependency ?
I am building a dashboard web application ASP.NET Core 3.1 that has a grid in which real-time data gets updated/inserted/deleted by multiple concurrent users. I found a few examples but they are for ASP.NET Core 2.x and not complete project examples. I don't know how I should be implementing the SignalR and SqlDependency pieces the "proper" way in my project.
The Java client sample needs to be updated to use the preview 3 packages. Because of how we do network calls now it's not just as easy as updating the dependency.
WindowsForms has a Chat so I assume it should connect to the Server created by ChatSample.
Now the method signatures are out of sync and WinClient cannot connect anywhere.
i am getting this error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.