52 lines
1.6 KiB
HTML
52 lines
1.6 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<title>SignalR WebView Client</title>
|
||
|
|
|
||
|
|
<!-- jQuery (required) -->
|
||
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||
|
|
|
||
|
|
<!-- SignalR JS Client (use this working CDN) -->
|
||
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/microsoft-signalr/2.4.3/jquery.signalR.min.js"></script>
|
||
|
|
|
||
|
|
<!-- Auto-generated Hubs script from your server -->
|
||
|
|
<script src="https://www.pozo.ai/pozo-signalr-hub/signalr/hubs"></script>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<h2>Connecting to Classic ASP.NET SignalR...</h2>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
console.log("✅ HTML loaded in WebView");
|
||
|
|
|
||
|
|
// Set connection URL
|
||
|
|
$.connection.hub.url = "https://www.pozo.ai/pozo-signalr-hub/signalr";
|
||
|
|
|
||
|
|
// Replace with your hub name in C#
|
||
|
|
const hub = $.connection.notificationHub;
|
||
|
|
|
||
|
|
// Message handler
|
||
|
|
hub.client.receiveProducts = function (message) {
|
||
|
|
console.log("✅ JS Received:", message);
|
||
|
|
if (typeof Android !== 'undefined' && Android.onMessageReceived) {
|
||
|
|
Android.onMessageReceived(message);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
// Start connection
|
||
|
|
$.connection.hub.start()
|
||
|
|
.done(function () {
|
||
|
|
console.log("✅ Connected to SignalR (classic)");
|
||
|
|
if (typeof Android !== 'undefined' && Android.onConnected) {
|
||
|
|
Android.onConnected("Connected to ASP.NET SignalR");
|
||
|
|
}
|
||
|
|
})
|
||
|
|
.fail(function (err) {
|
||
|
|
console.error("❌ Error connecting to SignalR", err);
|
||
|
|
if (typeof Android !== 'undefined' && Android.onError) {
|
||
|
|
Android.onError(err.toString());
|
||
|
|
}
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|