Hi,
The version used is 8.7.0.
We're currently trying to extend the chat functionality with a custom SignalR hub. Hoever, my colleague and I came across a very weird issue also illustrated in this thread: https://support.aspnetzero.com/QA/Questions/9080/Javascript-Error
The difference being that we didn't manage to encounter any exception using Postman, yet all properties of global variable abp
cannot be found. The two properties we're trying to access are abp.services.app
and abp.signalr
.
I've attached a screenshot to illustrate how logging the abp
to the console inside my partial view displays all the available and filled properties. But then, the next line of code (so no in-between tampering or mutation), it says it cannot call startConnection()
because abp.signalr
is undefined all of a sudden.
The startConnection()
method call is executed as such and we've mapped the hub in Startup.cs.
<script type="text/javascript">
var registrationChatHub = null;
var abp = abp;
console.log('ABP contents:', abp);
abp.signalr.startConnection(abp.appPath + 'signalr-chat-registration', function (connection) {
registrationChatHub = connection; // save reference
connection.on('getMessage', function (message) {
console.log('received msg:', message);
});
}).then(function (connection) {
abp.log.debug('Connected to RegistrationHub server.');
abp.event.trigger('registrationHub.connected');
});
abp.event.on('registrationHub.connected', function () {
registrationChatHub.invoke('sendMessage', 'Hello!');
});
</script>
Any help would be greatly appreciated.
1 Answer(s)
-
0
Can you please check whether you implement
<script src="@(ApplicationPath)view-resources/Areas/AppAreaName/Views/_Bundles/signalr.bundle.min.js" asp-append-version="true"></script>
before your script