how to use signalr in wechat miniprogram?

mc 5,426 Reputation points
2023-06-10T13:47:29.28+00:00

there will be error:

module 'utils/microsoft-signalr/ws.js' is not defined, require args is 'ws'

here is my code:

var signalr =require('./utils/microsoft-signalr/signalr')
var connection=new signalr.HubConnectionBuilder().withUrl('https://read.huafajiaoyu.com/api/ws-socket-hub').build();
Developer technologies ASP.NET ASP.NET Core
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-06-10T15:57:58.1033333+00:00

    The error states that the file ./utils/microsoft-signalr/signalr.js is looking for an additional files. How did you install the client, and are you using the correct one. There is a signalr client for 4.* and one core core. They are not compatible.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.