mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
17 lines
520 B
TypeScript
17 lines
520 B
TypeScript
import { hubConnection } from 'signalr-no-jquery';
|
|
|
|
const connection = hubConnection('http://[address]:[port]');
|
|
const hubProxy = connection.createHubProxy('hubNameString');
|
|
|
|
// set up event listeners i.e. for incoming "message" event
|
|
hubProxy.on('message', (message) => {
|
|
console.log(message);
|
|
});
|
|
|
|
// connect
|
|
connection.start({ jsonp: true })
|
|
.done(() => { console.log('Now connected, connection ID=' + connection.id); })
|
|
.fail(() => { console.log('Could not connect'); });
|
|
|
|
connection.stop(false, false);
|