mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
update to v5
This commit is contained in:
+22
-18
@@ -26,10 +26,12 @@ let id: number = ws.getSessionId();
|
||||
ws.disconnect();
|
||||
ws.abort();
|
||||
|
||||
ws.subscribe('system.monitor.update', (args: any[], kwargs: any) => {
|
||||
ws.subscribe('system.monitor.update', (args: any[], kwargs: any) =>
|
||||
{
|
||||
console.log('Received system.monitor.update event!');
|
||||
})
|
||||
.subscribe('client.message', function (args: any[], kwargs: any) {
|
||||
.subscribe('client.message', function (args: any[], kwargs: any)
|
||||
{
|
||||
console.log('Received client.message event!');
|
||||
});
|
||||
|
||||
@@ -40,11 +42,13 @@ ws.unsubscribe('subscribed.topic', f1);
|
||||
ws.unsubscribe('chat.message.received');
|
||||
|
||||
ws.call('get.server.time', null, {
|
||||
onSuccess: (args: any[], kwargs: any) => {
|
||||
onSuccess: (args: any[], kwargs: any) =>
|
||||
{
|
||||
console.log('RPC successfully called');
|
||||
console.log('Server time is ' + kwargs);
|
||||
},
|
||||
onError: (err: string, details: any, args: any[], kwargs: any) => {
|
||||
onError: (err: string, details: any, args: any[], kwargs: any) =>
|
||||
{
|
||||
console.log('RPC call failed with error ' + err);
|
||||
}
|
||||
});
|
||||
@@ -55,45 +59,45 @@ ws.getOpStatus();
|
||||
ws.publish('user.logged.in');
|
||||
ws.publish('chat.message.received', 'user message');
|
||||
ws.publish('chat.message.received', ['user message1', 'user message2']);
|
||||
ws.publish('user.modified', { field1: 'field1', field2: true, field3: 123 });
|
||||
ws.publish('user.modified', { field1: 'field1', field2: true, field3: 123 }, {
|
||||
onSuccess: () => console.log('User successfully modified')
|
||||
ws.publish('user.modified', {field1: 'field1', field2: true, field3: 123});
|
||||
ws.publish('user.modified', {field1: 'field1', field2: true, field3: 123}, {
|
||||
onSuccess: () => console.log('User successfully modified')
|
||||
});
|
||||
ws.publish('user.modified', { field1: 'field1', field2: true, field3: 123 }, {
|
||||
onSuccess: () => console.log('User successfully modified'),
|
||||
onError: (err: string, details: any) => console.log('User modification failed', err)
|
||||
ws.publish('user.modified', {field1: 'field1', field2: true, field3: 123}, {
|
||||
onSuccess: () => console.log('User successfully modified'),
|
||||
onError: (err: string, details: any) => console.log('User modification failed', err)
|
||||
});
|
||||
ws.publish('chat.message.received', ['Private message'], null, { eligible: 123456789 });
|
||||
ws.publish('chat.message.received', ['Private message'], null, {eligible: 123456789});
|
||||
|
||||
ws.call('server.time', null, (args: any[], kwargs: any) => console.log('Server time is ' + args[0]));
|
||||
|
||||
ws.call('start.migration', null, {
|
||||
onSuccess: (args: any[], kwargs: any) => console.log('RPC successfully called'),
|
||||
onError: (err: string, details: any, args: any[], kwargs: any) => console.log('RPC call failed!',err)
|
||||
onError: (err: string, details: any, args: any[], kwargs: any) => console.log('RPC call failed!', err)
|
||||
});
|
||||
|
||||
ws.call('restore.backup', { backupFile: 'backup.zip' }, {
|
||||
ws.call('restore.backup', {backupFile: 'backup.zip'}, {
|
||||
onSuccess: (args: any[], kwargs: any) => console.log('Backup successfully restored'),
|
||||
onError: (err: string, details: any, args: any[], kwargs: any) => console.log('Restore failed!',err)
|
||||
onError: (err: string, details: any, args: any[], kwargs: any) => console.log('Restore failed!', err)
|
||||
});
|
||||
|
||||
ws.call('start.migration', null, {
|
||||
onSuccess: (args: any[], kwargs: any) => console.log('RPC successfully called'),
|
||||
onError: (err: string, details: any, args: any[], kwargs: any) => console.log('RPC call failed!',err)
|
||||
onError: (err: string, details: any, args: any[], kwargs: any) => console.log('RPC call failed!', err)
|
||||
});
|
||||
|
||||
let status = ws.getOpStatus();
|
||||
|
||||
ws.cancel(status.reqId);
|
||||
|
||||
let sqrt_f = (x: number, y: any) => [{}, x*x];
|
||||
let sqrt_f = (args: any[], kwargs: any, options: any) => [{}, kwargs * kwargs];
|
||||
|
||||
ws.register('sqrt.value', sqrt_f);
|
||||
|
||||
ws.register('sqrt.value', {
|
||||
rpc: sqrt_f,
|
||||
onSuccess: (data: any) => console.log('RPC successfully registered'),
|
||||
onError: (err: string, details: any) => console.log('RPC registration failed!',err)
|
||||
onSuccess: (args: any[], kwargs: any) => console.log('RPC successfully registered'),
|
||||
onError: (err: string, details: any) => console.log('RPC registration failed!', err)
|
||||
});
|
||||
|
||||
ws.unregister('sqrt.value');
|
||||
|
||||
Vendored
+4
-5
@@ -8,7 +8,6 @@ interface WampyOptions
|
||||
autoReconnect?: boolean;
|
||||
reconnectInterval?: number;
|
||||
maxRetries?: number;
|
||||
transportEncoding?: string;
|
||||
realm?: string;
|
||||
helloCustomDetails?: any;
|
||||
onChallenge?: (auth_method: string, challenge_details: string) => string;
|
||||
@@ -19,7 +18,7 @@ interface WampyOptions
|
||||
onReconnect?: () => void;
|
||||
onReconnectSuccess?: () => void;
|
||||
ws?: any;
|
||||
msgpackCoder?: any;
|
||||
serializer?: any;
|
||||
}
|
||||
|
||||
interface WampyOpStatus
|
||||
@@ -31,7 +30,7 @@ interface WampyOpStatus
|
||||
|
||||
interface SuccessErrorCallbacksHash
|
||||
{
|
||||
onSuccess?: (data: any) => void;
|
||||
onSuccess?: (args: any[], kwargs: any) => void;
|
||||
onError?: (err: string, details: any) => void;
|
||||
}
|
||||
|
||||
@@ -42,7 +41,7 @@ interface SubscribeCallbacksHash extends SuccessErrorCallbacksHash
|
||||
|
||||
interface RegisterCallbacksHash extends SuccessErrorCallbacksHash
|
||||
{
|
||||
rpc: (data: any, options: any) => any[];
|
||||
rpc: (args: any[], kwargs: any, options: any) => any[];
|
||||
}
|
||||
|
||||
interface CallSuccessErrorCallbacksHash
|
||||
@@ -101,7 +100,7 @@ interface Wampy
|
||||
cancel(reqId: number,
|
||||
callbacks?: ((() => void) | SuccessErrorCallbacksHash),
|
||||
advancedOptions?: CancelAdvancedOptions): Wampy;
|
||||
register(topicURI: string, callbacks: (((data: any, options: any) => any[]) | RegisterCallbacksHash)): Wampy;
|
||||
register(topicURI: string, callbacks: (((args: any[], kwargs: any, options: any) => any[]) | RegisterCallbacksHash)): Wampy;
|
||||
unregister(topicURI: string, callbacks?: ((() => void) | SuccessErrorCallbacksHash)): Wampy;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user