Merge branch 'release/2.2'
This commit is contained in:
commit
f9d219acbb
|
|
@ -15,7 +15,7 @@
|
|||
</PropertyGroup>
|
||||
<Target Name="RestoreNpm" Condition="'$(PreflightRestore)' != 'True'">
|
||||
<Message Text="Restoring NPM modules" Importance="high" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts/common" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts/FunctionalTests" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts/signalr" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts/signalr-protocol-msgpack" />
|
||||
|
|
|
|||
|
|
@ -90,22 +90,44 @@ public class HubConnection {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the {@link HubConnection} class.
|
||||
* @param url The url of the SignalR server to connect to.
|
||||
* @param transport The {@link Transport} that the client will use to communicate with the server.
|
||||
*/
|
||||
public HubConnection(String url, Transport transport) {
|
||||
this(url, transport, new NullLogger());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the {@link HubConnection} class.
|
||||
* @param url The url of the SignalR server to connect to.
|
||||
*/
|
||||
public HubConnection(String url) {
|
||||
this(url, null, new NullLogger());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the {@link HubConnection} class.
|
||||
* @param url The url of the SignalR server to connect to.
|
||||
* @param logLevel The minimum level of messages to log.
|
||||
*/
|
||||
public HubConnection(String url, LogLevel logLevel){
|
||||
this(url, null, new ConsoleLogger(logLevel));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the state of the {@link HubConnection} to the server.
|
||||
* @return HubConnection state enum.
|
||||
*/
|
||||
public HubConnectionState getConnectionState() {
|
||||
return connectionState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a connection to the server.
|
||||
* @throws Exception An error occurred while connecting.
|
||||
*/
|
||||
public void start() throws Exception {
|
||||
logger.log(LogLevel.Debug, "Starting HubConnection");
|
||||
transport.setOnReceive(this.callback);
|
||||
|
|
@ -116,6 +138,9 @@ public class HubConnection {
|
|||
logger.log(LogLevel.Information, "HubConnected started");
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops a connection to the server.
|
||||
*/
|
||||
public void stop(){
|
||||
logger.log(LogLevel.Debug, "Stopping HubConnection");
|
||||
transport.stop();
|
||||
|
|
@ -123,6 +148,13 @@ public class HubConnection {
|
|||
logger.log(LogLevel.Information, "HubConnection stopped");
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes a hub method on the server using the specified method name.
|
||||
* Does not wait for a response from the receiver.
|
||||
* @param method The name of the server method to invoke.
|
||||
* @param args The arguments to be passed to the method.
|
||||
* @throws Exception If there was an error while sending.
|
||||
*/
|
||||
public void send(String method, Object... args) throws Exception {
|
||||
InvocationMessage invocationMessage = new InvocationMessage(method, args);
|
||||
String message = protocol.writeMessage(invocationMessage);
|
||||
|
|
@ -130,6 +162,12 @@ public class HubConnection {
|
|||
transport.send(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public Subscription on(String target, Action callback) {
|
||||
ActionBase action = args -> callback.invoke();
|
||||
handlers.put(target, action);
|
||||
|
|
@ -137,6 +175,14 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @param param1 The first parameter.
|
||||
* @param <T1> The first argument type.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public <T1> Subscription on(String target, Action1<T1> callback, Class<T1> param1) {
|
||||
ActionBase action = params -> callback.invoke(param1.cast(params[0]));
|
||||
handlers.put(target, action);
|
||||
|
|
@ -144,6 +190,16 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @param param1 The first parameter.
|
||||
* @param param2 The second parameter.
|
||||
* @param <T1> The first parameter type.
|
||||
* @param <T2> The second parameter type.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public <T1, T2> Subscription on(String target, Action2<T1, T2> callback, Class<T1> param1, Class<T2> param2) {
|
||||
ActionBase action = params -> {
|
||||
callback.invoke(param1.cast(params[0]), param2.cast(params[1]));
|
||||
|
|
@ -153,6 +209,18 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @param param1 The first parameter.
|
||||
* @param param2 The second parameter.
|
||||
* @param param3 The third parameter.
|
||||
* @param <T1> The first parameter type.
|
||||
* @param <T2> The second parameter type.
|
||||
* @param <T3> The third parameter type.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public <T1, T2, T3> Subscription on(String target, Action3<T1, T2, T3> callback,
|
||||
Class<T1> param1, Class<T2> param2, Class<T3> param3) {
|
||||
ActionBase action = params -> {
|
||||
|
|
@ -163,6 +231,20 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @param param1 The first parameter.
|
||||
* @param param2 The second parameter.
|
||||
* @param param3 The third parameter.
|
||||
* @param param4 The fourth parameter.
|
||||
* @param <T1> The first parameter type.
|
||||
* @param <T2> The second parameter type.
|
||||
* @param <T3> The third parameter type.
|
||||
* @param <T4> The fourth parameter type.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public <T1, T2, T3, T4> Subscription on(String target, Action4<T1, T2, T3, T4> callback,
|
||||
Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4) {
|
||||
ActionBase action = params -> {
|
||||
|
|
@ -173,6 +255,22 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @param param1 The first parameter.
|
||||
* @param param2 The second parameter.
|
||||
* @param param3 The third parameter.
|
||||
* @param param4 The fourth parameter.
|
||||
* @param param5 The fifth parameter.
|
||||
* @param <T1> The first parameter type.
|
||||
* @param <T2> The second parameter type.
|
||||
* @param <T3> The third parameter type.
|
||||
* @param <T4> The fourth parameter type.
|
||||
* @param <T5> The fifth parameter type.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public <T1, T2, T3, T4, T5> Subscription on(String target, Action5<T1, T2, T3, T4, T5> callback,
|
||||
Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4, Class<T5> param5) {
|
||||
ActionBase action = params -> {
|
||||
|
|
@ -184,6 +282,24 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @param param1 The first parameter.
|
||||
* @param param2 The second parameter.
|
||||
* @param param3 The third parameter.
|
||||
* @param param4 The fourth parameter.
|
||||
* @param param5 The fifth parameter.
|
||||
* @param param6 The sixth parameter.
|
||||
* @param <T1> The first parameter type.
|
||||
* @param <T2> The second parameter type.
|
||||
* @param <T3> The third parameter type.
|
||||
* @param <T4> The fourth parameter type.
|
||||
* @param <T5> The fifth parameter type.
|
||||
* @param <T6> The sixth parameter type.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public <T1, T2, T3, T4, T5, T6> Subscription on(String target, Action6<T1, T2, T3, T4, T5, T6> callback,
|
||||
Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4, Class<T5> param5, Class<T6> param6) {
|
||||
ActionBase action = params -> {
|
||||
|
|
@ -195,6 +311,26 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @param param1 The first parameter.
|
||||
* @param param2 The second parameter.
|
||||
* @param param3 The third parameter.
|
||||
* @param param4 The fourth parameter.
|
||||
* @param param5 The fifth parameter.
|
||||
* @param param6 The sixth parameter.
|
||||
* @param param7 The seventh parameter.
|
||||
* @param <T1> The first parameter type.
|
||||
* @param <T2> The second parameter type.
|
||||
* @param <T3> The third parameter type.
|
||||
* @param <T4> The fourth parameter type.
|
||||
* @param <T5> The fifth parameter type.
|
||||
* @param <T6> The sixth parameter type.
|
||||
* @param <T7> The seventh parameter type.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public <T1, T2, T3, T4, T5, T6, T7> Subscription on(String target, Action7<T1, T2, T3, T4, T5, T6, T7> callback,
|
||||
Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4, Class<T5> param5, Class<T6> param6, Class<T7> param7) {
|
||||
ActionBase action = params -> {
|
||||
|
|
@ -206,6 +342,28 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler that will be invoked when the hub method with the specified method name is invoked.
|
||||
* @param target The name of the hub method to define.
|
||||
* @param callback The handler that will be raised when the hub method is invoked.
|
||||
* @param param1 The first parameter.
|
||||
* @param param2 The second parameter.
|
||||
* @param param3 The third parameter.
|
||||
* @param param4 The fourth parameter.
|
||||
* @param param5 The fifth parameter.
|
||||
* @param param6 The sixth parameter.
|
||||
* @param param7 The seventh parameter.
|
||||
* @param param8 The eighth parameter
|
||||
* @param <T1> The first parameter type.
|
||||
* @param <T2> The second parameter type.
|
||||
* @param <T3> The third parameter type.
|
||||
* @param <T4> The fourth parameter type.
|
||||
* @param <T5> The fifth parameter type.
|
||||
* @param <T6> The sixth parameter type.
|
||||
* @param <T7> The seventh parameter type.
|
||||
* @param <T8> The eighth parameter type.
|
||||
* @return A {@link Subscription} that can be disposed to unsubscribe from the hub method.
|
||||
*/
|
||||
public <T1, T2, T3, T4, T5, T6, T7, T8> Subscription on(String target, Action8<T1, T2, T3, T4, T5, T6, T7, T8> callback,
|
||||
Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4, Class<T5> param5, Class<T6> param6, Class<T7> param7, Class<T8> param8) {
|
||||
ActionBase action = params -> {
|
||||
|
|
@ -217,6 +375,10 @@ public class HubConnection {
|
|||
return new Subscription(handlers, action, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all handlers associated with the method with the specified method name.
|
||||
* @param name The name of the hub method from which handlers are being removed.
|
||||
*/
|
||||
public void remove(String name) {
|
||||
handlers.remove(name);
|
||||
logger.log(LogLevel.Trace, "Removing handlers for client method %s" , name);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
/**
|
||||
* A base class for hub messages.
|
||||
*/
|
||||
public abstract class HubMessage {
|
||||
abstract HubMessageType getMessageType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,26 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
/**
|
||||
* A protocol abstraction for communicating with SignalR hubs.
|
||||
*/
|
||||
public interface HubProtocol {
|
||||
String getName();
|
||||
int getVersion();
|
||||
TransferFormat getTransferFormat();
|
||||
|
||||
/**
|
||||
* Creates a new list of {@link HubMessage}s.
|
||||
* @param message A string representation of one or more {@link HubMessage}s.
|
||||
* @return A list of {@link HubMessage}s.
|
||||
*/
|
||||
HubMessage[] parseMessages(String message);
|
||||
|
||||
/**
|
||||
* Writes the specified {@link HubMessage} to a String.
|
||||
* @param message The message to write.
|
||||
* @return A string representation of the message.
|
||||
*/
|
||||
String writeMessage(HubMessage message);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@
|
|||
"es6-promise": {
|
||||
"version": "4.2.2",
|
||||
"bundled": true
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.9.3",
|
||||
"bundled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -111,6 +115,10 @@
|
|||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.9.3",
|
||||
"bundled": true
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true
|
||||
|
|
@ -791,9 +799,9 @@
|
|||
}
|
||||
},
|
||||
"circular-json": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.4.tgz",
|
||||
"integrity": "sha512-vnJA8KS0BfOihugYEUkLRcnmq21FbuivbxgzDLXNs3zIk4KllV4Mx4UuTzBXht9F00C7QfD1YqMXg1zP6EXpig==",
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.5.tgz",
|
||||
"integrity": "sha512-13YaR6kiz0kBNmIVM87Io8Hp7bWOo4r61vkEANy8iH9R9bc6avud/1FT0SBpqR1RpIQADOh/Q+yHZDA1iL6ysA==",
|
||||
"dev": true
|
||||
},
|
||||
"class-utils": {
|
||||
|
|
@ -875,9 +883,9 @@
|
|||
}
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||
"version": "2.16.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz",
|
||||
"integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
|
|
@ -1259,9 +1267,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"escodegen": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.10.0.tgz",
|
||||
"integrity": "sha1-9kc5XeIlGfvQ2Sj/zx0X4N7CYD4=",
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz",
|
||||
"integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
|
|
@ -1676,12 +1684,14 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
|
@ -1696,17 +1706,20 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
|
@ -1823,7 +1836,8 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
|
@ -1835,6 +1849,7 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
|
@ -1849,6 +1864,7 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
|
@ -1856,12 +1872,14 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.2.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.1",
|
||||
"yallist": "^3.0.0"
|
||||
|
|
@ -1880,6 +1898,7 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
|
@ -1960,7 +1979,8 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
|
@ -1972,6 +1992,7 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
|
@ -2093,6 +2114,7 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
|
@ -3004,9 +3026,9 @@
|
|||
}
|
||||
},
|
||||
"log4js": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/log4js/-/log4js-2.10.0.tgz",
|
||||
"integrity": "sha1-SYC9kUigMNafnt3jKlsZwKVR4sQ=",
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/log4js/-/log4js-2.11.0.tgz",
|
||||
"integrity": "sha512-z1XdwyGFg8/WGkOyF6DPJjivCWNLKrklGdViywdYnSKOvgtEBo2UyEMZS5sD2mZrQlU3TvO8wDWLc8mzE1ncBQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"amqplib": "^0.5.2",
|
||||
|
|
@ -3688,6 +3710,19 @@
|
|||
"pac-resolver": "^3.0.0",
|
||||
"raw-body": "^2.2.0",
|
||||
"socks-proxy-agent": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"socks-proxy-agent": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-3.0.1.tgz",
|
||||
"integrity": "sha512-ZwEDymm204mTzvdqyUqOdovVr2YRd2NYskrYrF2LXyZ9qDiMAoFESGK8CRphiO7rtbo2Y757k2Nia3x2hGtalA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"agent-base": "^4.1.0",
|
||||
"socks": "^1.1.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"pac-resolver": {
|
||||
|
|
@ -3822,9 +3857,9 @@
|
|||
}
|
||||
},
|
||||
"proxy-agent": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-3.0.0.tgz",
|
||||
"integrity": "sha1-9naOICiJsihdOZBtOpR2hBb49xM=",
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-3.0.1.tgz",
|
||||
"integrity": "sha512-mAZexaz9ZxQhYPWfAjzlrloEjW+JHiBFryE4AJXFDTnaXfmH/FKqC1swTRKuEPbHWz02flQNXFOyDUF7zfEG6A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
|
|
@ -3835,7 +3870,7 @@
|
|||
"lru-cache": "^4.1.2",
|
||||
"pac-proxy-agent": "^2.0.1",
|
||||
"proxy-from-env": "^1.0.0",
|
||||
"socks-proxy-agent": "^3.0.0"
|
||||
"socks-proxy-agent": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"proxy-from-env": {
|
||||
|
|
@ -4140,7 +4175,8 @@
|
|||
"version": "1.1.15",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-1.1.15.tgz",
|
||||
"integrity": "sha1-fxFLW2X6s+KjWqd1uxLw0cZJvxY=",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"smtp-connection": {
|
||||
"version": "2.12.0",
|
||||
|
|
@ -4371,19 +4407,41 @@
|
|||
"resolved": "https://registry.npmjs.org/socks/-/socks-1.1.10.tgz",
|
||||
"integrity": "sha1-W4t/x8jzQcU+0FbpKbe/Tei6e1o=",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ip": "^1.1.4",
|
||||
"smart-buffer": "^1.0.13"
|
||||
}
|
||||
},
|
||||
"socks-proxy-agent": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-3.0.1.tgz",
|
||||
"integrity": "sha1-Lq58+OKoLTRWV2FTmn+XGMVhdlk=",
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.1.tgz",
|
||||
"integrity": "sha512-Kezx6/VBguXOsEe5oU3lXYyKMi4+gva72TwJ7pQY5JfqUx2nMk7NXA6z/mpNqIlfQjWYVfeuNvQjexiTaTn6Nw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"agent-base": "^4.1.0",
|
||||
"socks": "^1.1.10"
|
||||
"agent-base": "~4.2.0",
|
||||
"socks": "~2.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"smart-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-RFqinRVJVcCAL9Uh1oVqE6FZkqsyLiVOYEZ20TqIOjuX7iFVJ+zsbs4RIghnw/pTs7mZvt8ZHhvm1ZUrR4fykg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"socks": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.2.1.tgz",
|
||||
"integrity": "sha512-0GabKw7n9mI46vcNrVfs0o6XzWzjVa3h6GaSo2UPxtWAROXUWavfJWh1M4PR5tnE0dcnQXZIDFP4yrAysLze/w==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ip": "^1.1.5",
|
||||
"smart-buffer": "^4.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
|
|
@ -4728,6 +4786,12 @@
|
|||
"mime-types": "~2.1.18"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz",
|
||||
"integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==",
|
||||
"dev": true
|
||||
},
|
||||
"ultron": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
|
||||
|
|
|
|||
|
|
@ -29,13 +29,14 @@
|
|||
"karma-sauce-launcher": "^1.2.0",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-summary-reporter": "^1.5.0",
|
||||
"ts-node": "^4.1.0"
|
||||
"ts-node": "^4.1.0",
|
||||
"typescript": "^3.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "node ../node_modules/rimraf/bin.js ./wwwroot/dist ./obj/js",
|
||||
"clean": "node ../common/node_modules/rimraf/bin.js ./wwwroot/dist ./obj/js",
|
||||
"build": "npm run clean && npm run build:lint && npm run build:webpack",
|
||||
"build:lint": "node ../node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:webpack": "node ../node_modules/webpack-cli/bin/cli.js",
|
||||
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:webpack": "node ../common/node_modules/webpack-cli/bin/cli.js",
|
||||
"build:parent": "cd .. && npm run build",
|
||||
"pretest": "npm run build:parent && npm run build && dotnet build",
|
||||
"test": "npm run test:local --",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
// This code uses a lot of `.then` instead of `await` and TSLint doesn't like it.
|
||||
// tslint:disable:no-floating-promises
|
||||
|
||||
import { HttpTransportType, IHttpConnectionOptions, TransferFormat } from "@aspnet/signalr";
|
||||
import { eachTransport, ECHOENDPOINT_URL } from "./Common";
|
||||
import { TestLogger } from "./TestLogger";
|
||||
|
|
@ -23,13 +26,13 @@ describe("connection", () => {
|
|||
...commonOptions,
|
||||
});
|
||||
|
||||
connection.onreceive = (data) => {
|
||||
connection.onreceive = async (data: any) => {
|
||||
if (data === message) {
|
||||
connection.stop();
|
||||
}
|
||||
};
|
||||
|
||||
connection.onclose = (error) => {
|
||||
connection.onclose = (error: any) => {
|
||||
expect(error).toBeUndefined();
|
||||
done();
|
||||
};
|
||||
|
|
@ -53,20 +56,20 @@ describe("connection", () => {
|
|||
transport: transportType,
|
||||
});
|
||||
|
||||
connection.onreceive = (data) => {
|
||||
connection.onreceive = (data: any) => {
|
||||
if (data === message) {
|
||||
connection.stop();
|
||||
}
|
||||
};
|
||||
|
||||
connection.onclose = (error) => {
|
||||
connection.onclose = (error: any) => {
|
||||
expect(error).toBeUndefined();
|
||||
done();
|
||||
};
|
||||
|
||||
connection.start(TransferFormat.Text).then(() => {
|
||||
connection.send(message);
|
||||
}).catch((e) => {
|
||||
}).catch((e: any) => {
|
||||
fail(e);
|
||||
done();
|
||||
});
|
||||
|
|
@ -82,15 +85,17 @@ describe("connection", () => {
|
|||
transport: transportType,
|
||||
});
|
||||
|
||||
connection.onreceive = (data) => {
|
||||
connection.onreceive = (data: any) => {
|
||||
if (data === message) {
|
||||
connection.stop();
|
||||
}
|
||||
};
|
||||
|
||||
// @ts-ignore: We don't use the error parameter intentionally.
|
||||
connection.onclose = (error) => {
|
||||
// Search the logs for the message content
|
||||
expect(TestLogger.instance.currentLog.messages.length).toBeGreaterThan(0);
|
||||
// @ts-ignore: We don't use the _ or __ parameters intentionally.
|
||||
for (const [_, __, logMessage] of TestLogger.instance.currentLog.messages) {
|
||||
expect(logMessage).not.toContain(message);
|
||||
}
|
||||
|
|
@ -116,16 +121,18 @@ describe("connection", () => {
|
|||
transport: transportType,
|
||||
});
|
||||
|
||||
connection.onreceive = (data) => {
|
||||
connection.onreceive = (data: any) => {
|
||||
if (data === message) {
|
||||
connection.stop();
|
||||
}
|
||||
};
|
||||
|
||||
// @ts-ignore: We don't use the error parameter intentionally.
|
||||
connection.onclose = (error) => {
|
||||
// Search the logs for the message content
|
||||
let matches = 0;
|
||||
expect(TestLogger.instance.currentLog.messages.length).toBeGreaterThan(0);
|
||||
// @ts-ignore: We don't use the _ or __ parameters intentionally.
|
||||
for (const [_, __, logMessage] of TestLogger.instance.currentLog.messages) {
|
||||
if (logMessage.indexOf(message) !== -1) {
|
||||
matches += 1;
|
||||
|
|
@ -139,7 +146,7 @@ describe("connection", () => {
|
|||
|
||||
connection.start(TransferFormat.Text).then(() => {
|
||||
connection.send(message);
|
||||
}).catch((e) => {
|
||||
}).catch((e: any) => {
|
||||
fail(e);
|
||||
done();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
// This code uses a lot of `.then` instead of `await` and TSLint doesn't like it.
|
||||
// tslint:disable:no-floating-promises
|
||||
|
||||
import { AbortError, DefaultHttpClient, HttpClient, HttpRequest, HttpResponse, HttpTransportType, HubConnectionBuilder, IHttpConnectionOptions, JsonHubProtocol } from "@aspnet/signalr";
|
||||
import { MessagePackHubProtocol } from "@aspnet/signalr-protocol-msgpack";
|
||||
|
||||
|
|
@ -221,7 +224,7 @@ describe("hubConnection", () => {
|
|||
hubConnection.stop();
|
||||
done();
|
||||
},
|
||||
next(item) {
|
||||
next() {
|
||||
hubConnection.stop();
|
||||
fail();
|
||||
},
|
||||
|
|
@ -248,7 +251,7 @@ describe("hubConnection", () => {
|
|||
hubConnection.stop();
|
||||
done();
|
||||
},
|
||||
next(item) {
|
||||
next() {
|
||||
hubConnection.stop();
|
||||
fail();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
export class LogBannerReporter implements jasmine.CustomReporter {
|
||||
public jasmineStarted(suiteInfo: jasmine.SuiteInfo): void {
|
||||
public jasmineStarted(): void {
|
||||
console.log("*** JASMINE SUITE STARTED ***");
|
||||
}
|
||||
|
||||
public jasmineDone(runDetails: jasmine.RunDetails): void {
|
||||
public jasmineDone(): void {
|
||||
console.log("*** JASMINE SUITE FINISHED ***");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const webpack = require("../common/node_modules/webpack");
|
||||
|
||||
module.exports = {
|
||||
entry: path.resolve(__dirname, "ts", "index.ts"),
|
||||
|
|
@ -24,6 +24,10 @@ module.exports = {
|
|||
}
|
||||
]
|
||||
},
|
||||
resolveLoader: {
|
||||
// Special resolution rules for loaders (which are in the 'common' directory)
|
||||
modules: [ path.resolve(__dirname, "..", "common", "node_modules") ],
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"]
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "common",
|
||||
"version": "1.0.0",
|
||||
"description": "Common dependencies used during dev time. DO NOT PUBLISH",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^22.2.3",
|
||||
"@types/node": "^8.5.2",
|
||||
"@types/webpack": "^4.4.0",
|
||||
"jest": "^22.4.3",
|
||||
"rimraf": "^2.6.2",
|
||||
"ts-jest": "^22.4.6",
|
||||
"ts-loader": "^4.4.1",
|
||||
"tslint": "^5.9.1",
|
||||
"typescript": "^2.7.1",
|
||||
"uglify-js": "^3.3.5",
|
||||
"webpack": "^4.12.0",
|
||||
"webpack-cli": "^3.0.3"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,30 +1,16 @@
|
|||
{
|
||||
"name": "client-ts",
|
||||
"version": "0.0.0",
|
||||
"description": "Common dev-time dependencies for SignalR NPM packages. NOT FOR PUBLISHING",
|
||||
"main": "index.js",
|
||||
"description": "Provides a root to run npm scripts from. DO NOT PUBLISH",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "cd ./signalr && npm run build && cd ../signalr-protocol-msgpack && npm run build",
|
||||
"pretest": "tslint -c ./tslint.json -p ./signalr/tests/tsconfig.json && tslint -c ./tslint.json -p ./signalr-protocol-msgpack/tests/tsconfig.json",
|
||||
"test": "jest",
|
||||
"coverage": "jest --coverage"
|
||||
"pretest": "node ./common/node_modules/tslint/bin/tslint -c ./tslint.json -p ./signalr/tests/tsconfig.json && node ./common/node_modules/tslint/bin/tslint -c ./tslint.json -p ./signalr-protocol-msgpack/tests/tsconfig.json",
|
||||
"test": "node ./common/node_modules/jest/bin/jest.js",
|
||||
"coverage": "node ./common/node_modules/jest/bin/jest.js --coverage"
|
||||
},
|
||||
"author": "Microsoft",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^22.2.3",
|
||||
"@types/node": "^8.5.2",
|
||||
"@types/webpack": "^4.4.0",
|
||||
"jest": "^22.4.3",
|
||||
"rimraf": "^2.6.2",
|
||||
"ts-jest": "^22.4.6",
|
||||
"ts-loader": "^4.4.1",
|
||||
"tslint": "^5.9.1",
|
||||
"typescript": "^2.7.1",
|
||||
"uglify-js": "^3.3.5",
|
||||
"webpack": "^4.12.0",
|
||||
"webpack-cli": "^3.0.3"
|
||||
},
|
||||
"jest": {
|
||||
"globals": {
|
||||
"ts-jest": {
|
||||
|
|
@ -34,12 +20,13 @@
|
|||
}
|
||||
},
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
"^.+\\.tsx?$": "./common/node_modules/ts-jest"
|
||||
},
|
||||
"testEnvironment": "node",
|
||||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||
"moduleNameMapper": {
|
||||
"^@aspnet/signalr$": "<rootDir>/signalr/src/index.ts"
|
||||
"^ts-jest$": "<rootDir>/common/node_modules/ts-jest",
|
||||
"^@aspnet/signalr$": "<rootDir>/signalr/dist/cjs/index.js"
|
||||
},
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import sourceMaps from 'rollup-plugin-sourcemaps'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
|
||||
let polyfills = [ 'es6-promise', 'buffer', 'base64-js', 'ieee754' ];
|
||||
let allowed_externals = [ ];
|
||||
|
||||
export default function(rootDir, moduleGlobals) {
|
||||
let pkg = require(path.join(rootDir, "package.json"));
|
||||
return {
|
||||
input: path.join(rootDir, "dist", "cjs", "browser-index.js"),
|
||||
output: {
|
||||
file: pkg.umd,
|
||||
format: "umd",
|
||||
name: pkg.umd_name,
|
||||
sourcemap: true,
|
||||
banner: "/** \r\n" +
|
||||
" * @overview ASP.NET Core SignalR JavaScript Client.\r\n" +
|
||||
" * @version 0.0.0-DEV_BUILD.\r\n" +
|
||||
" * @license\r\n" +
|
||||
" * Copyright (c) .NET Foundation. All rights reserved.\r\n" +
|
||||
" * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n" +
|
||||
" */",
|
||||
globals: moduleGlobals,
|
||||
},
|
||||
|
||||
// Mark everything in the dependencies list as external
|
||||
external: Object.keys(pkg.dependencies || {}),
|
||||
|
||||
plugins: [
|
||||
commonjs(),
|
||||
resolve({
|
||||
preferBuiltins: false
|
||||
}),
|
||||
sourceMaps()
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -11,13 +11,13 @@
|
|||
"test": "spec"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "node ../node_modules/rimraf/bin.js ./dist",
|
||||
"clean": "node ../common/node_modules/rimraf/bin.js ./dist",
|
||||
"build": "npm run clean && npm run build:lint && npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:uglify",
|
||||
"build:lint": "node ../node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:esm": "node ../node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
|
||||
"build:cjs": "node ../node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
|
||||
"build:browser": "node ../node_modules/webpack-cli/bin/cli.js",
|
||||
"build:uglify": "node ../node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'\" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js",
|
||||
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:esm": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
|
||||
"build:cjs": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
|
||||
"build:browser": "node ../common/node_modules/webpack-cli/bin/cli.js",
|
||||
"build:uglify": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'\" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js",
|
||||
"prepack": "node ../build/embed-version.js",
|
||||
"test": "echo \"Run 'npm test' in the 'clients\\ts' folder to test this package\" && exit 1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
const path = require("path");
|
||||
const baseConfig = require("../webpack.config.base");
|
||||
|
||||
module.exports = baseConfig(__dirname, "signalr-protocol-msgpack", {
|
||||
externals: {
|
||||
msgpack5: "msgpack5",
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@
|
|||
"test": "spec"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "node ../node_modules/rimraf/bin.js ./dist",
|
||||
"clean": "node ../common/node_modules/rimraf/bin.js ./dist",
|
||||
"build": "npm run clean && npm run build:lint && npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:uglify",
|
||||
"build:lint": "node ../node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:esm": "node ../node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d && node ./build/process-dts.js",
|
||||
"build:cjs": "node ../node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
|
||||
"build:browser": "node ../node_modules/webpack-cli/bin/cli.js",
|
||||
"build:uglify": "node ../node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/browser/signalr.js.map'\" --comments -o ./dist/browser/signalr.min.js ./dist/browser/signalr.js",
|
||||
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:esm": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d && node ./build/process-dts.js",
|
||||
"build:cjs": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
|
||||
"build:browser": "node ../common/node_modules/webpack-cli/bin/cli.js",
|
||||
"build:uglify": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/browser/signalr.js.map'\" --comments -o ./dist/browser/signalr.min.js ./dist/browser/signalr.js",
|
||||
"prepack": "node ../build/embed-version.js",
|
||||
"test": "echo \"Run 'npm test' in the 'clients\\ts' folder to test this package\" && exit 1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/** Error thrown when an HTTP request fails. */
|
||||
export class HttpError extends Error {
|
||||
// @ts-ignore: Intentionally unused.
|
||||
// tslint:disable-next-line:variable-name
|
||||
private __proto__: Error;
|
||||
|
||||
|
|
@ -27,6 +28,7 @@ export class HttpError extends Error {
|
|||
|
||||
/** Error thrown when a timeout elapses. */
|
||||
export class TimeoutError extends Error {
|
||||
// @ts-ignore: Intentionally unused.
|
||||
// tslint:disable-next-line:variable-name
|
||||
private __proto__: Error;
|
||||
|
||||
|
|
@ -46,6 +48,7 @@ export class TimeoutError extends Error {
|
|||
|
||||
/** Error thrown when an action is aborted. */
|
||||
export class AbortError extends Error {
|
||||
// @ts-ignore: Intentionally unused.
|
||||
// tslint:disable-next-line:variable-name
|
||||
private __proto__: Error;
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,11 @@ export class HubConnection {
|
|||
|
||||
private resetKeepAliveInterval() {
|
||||
this.cleanupPingTimer();
|
||||
this.pingServerHandle = setTimeout(() => this.sendMessage(this.cachedPingMessage), this.keepAliveIntervalInMilliseconds);
|
||||
this.pingServerHandle = setTimeout(async () => {
|
||||
if (this.connectionState === HubConnectionState.Connected) {
|
||||
await this.sendMessage(this.cachedPingMessage);
|
||||
}
|
||||
}, this.keepAliveIntervalInMilliseconds);
|
||||
}
|
||||
|
||||
private resetTimeoutPeriod() {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export class NullLogger implements ILogger {
|
|||
private constructor() {}
|
||||
|
||||
/** @inheritDoc */
|
||||
public log(logLevel: LogLevel, message: string): void {
|
||||
// tslint:disable-next-line
|
||||
public log(_logLevel: LogLevel, _message: string): void {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ export interface IStreamResult<T> {
|
|||
*
|
||||
* @typeparam T The type of the items being sent by the server.
|
||||
*/
|
||||
// We can't remove this, it's a breaking change, but it's not used.
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
// @ts-ignore: We can't remove this, it's a breaking change, but it's not used.
|
||||
export interface ISubscription<T> {
|
||||
/** Disconnects the {@link IStreamSubscriber} associated with this subscription from the stream. */
|
||||
dispose(): void;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class WebSocketTransport implements ITransport {
|
|||
webSocket.binaryType = "arraybuffer";
|
||||
}
|
||||
|
||||
webSocket.onopen = (event: Event) => {
|
||||
// tslint:disable-next-line:variable-name
|
||||
webSocket.onopen = (_event: Event) => {
|
||||
this.logger.log(LogLevel.Information, `WebSocket connected to ${url}`);
|
||||
this.webSocket = webSocket;
|
||||
resolve();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
"experimentalDecorators": true,
|
||||
"removeComments": false,
|
||||
"noImplicitAny": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noEmitOnError": true,
|
||||
"stripInternal": true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs"
|
||||
"module": "commonjs",
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"typeRoots": [
|
||||
"./common/node_modules/@types"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"./*/tests/**/*"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
"unified-signatures": false,
|
||||
"max-classes-per-file": false,
|
||||
"no-floating-promises": true,
|
||||
"no-unused-variable": [true, {"ignore-pattern": "^_"}],
|
||||
"no-empty": false,
|
||||
"no-bitwise": false,
|
||||
"no-console": false
|
||||
|
|
|
|||
|
|
@ -1,103 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test Page</title>
|
||||
<style>
|
||||
.test-success {
|
||||
color: green;
|
||||
}
|
||||
.test-failed {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test Page</h1>
|
||||
<p>This page validates that the UMD builds of the signalr-client and signalr-protocol-msgpack modules are available in the global scope when in a browser.</p>
|
||||
<h2>Test Results</h2>
|
||||
<ul id="results-list">
|
||||
</ul>
|
||||
<script src="./signalr-protocol-msgpack/node_modules/msgpack5/dist/msgpack5.js"></script>
|
||||
<script type="text/javascript">
|
||||
function getParameterByName(name, url) {
|
||||
if (!url) {
|
||||
url = window.location.href;
|
||||
}
|
||||
name = name.replace(/[\[\]]/g, "\\$&");
|
||||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
||||
results = regex.exec(url);
|
||||
if (!results) return null;
|
||||
if (!results[2]) return '';
|
||||
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
function importSignalR() {
|
||||
var minified = getParameterByName('min') === 'true' ? '.min' : '';
|
||||
document.write('<script type="text/javascript" src="./signalr/dist/browser/signalr' + minified + '.js"><\/script>');
|
||||
document.write('<script type="text/javascript" src="./signalr-protocol-msgpack/dist/browser/signalr-protocol-msgpack' + minified + '.js"><\/script>');
|
||||
}
|
||||
|
||||
var resultsList = document.getElementById("results-list");
|
||||
// Run tests
|
||||
function test(name, impl) {
|
||||
var result = ""
|
||||
var success = false;
|
||||
try {
|
||||
impl();
|
||||
result = "success";
|
||||
success = true;
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
result = "error: " + e;
|
||||
success = false;
|
||||
}
|
||||
|
||||
var cssClass = success ? "test-success": "test-failed";
|
||||
resultsList.innerHTML += "<li class=\"" + cssClass + "\">" + name + ": " + result + "</li>";
|
||||
}
|
||||
|
||||
test("Promise may not be available before the polyfill", function() {
|
||||
if(!Promise) {
|
||||
throw "Promise is falsey: " + Promise;
|
||||
}
|
||||
});
|
||||
|
||||
test("Buffer is not available before the polyfill", function() {
|
||||
if(typeof Buffer !== "undefined") {
|
||||
throw "Buffer is truthy: " + Buffer;
|
||||
}
|
||||
});
|
||||
|
||||
importSignalR();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
test("Promise is available after the polyfill", function() {
|
||||
if(!Promise) {
|
||||
throw "Promise is falsey: " + Promise;
|
||||
}
|
||||
});
|
||||
|
||||
test("Buffer is not available after the polyfill", function() {
|
||||
if(typeof Buffer !== "undefined") {
|
||||
throw "Buffer is truthy: " + Buffer;
|
||||
}
|
||||
});
|
||||
|
||||
test("signalR is available", function() {
|
||||
if(!window.signalR){
|
||||
throw "window.signalR is falsey: " + window.signalR;
|
||||
}
|
||||
});
|
||||
test("msgpack5 is available", function() {
|
||||
if(!window.msgpack5){
|
||||
throw "window.msgpack5 is falsey: " + window.msgpack5;
|
||||
}
|
||||
});
|
||||
test("signalR.protocols.msgpack.MessagePackHubProtocol is available", function() {
|
||||
if(!window.signalR.protocols.msgpack.MessagePackHubProtocol){
|
||||
throw "signalR.protocols.msgpack is falsey: " + signalR.protocols.msgpack.MessagePackHubProtocol;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const webpack = require("./common/node_modules/webpack");
|
||||
|
||||
module.exports = function (modulePath, browserBaseName, options) {
|
||||
const pkg = require(path.resolve(modulePath, "package.json"));
|
||||
|
|
@ -17,6 +17,10 @@ module.exports = function (modulePath, browserBaseName, options) {
|
|||
process: false,
|
||||
Buffer: false,
|
||||
},
|
||||
resolveLoader: {
|
||||
// Special resolution rules for loaders (which are in the 'common' directory)
|
||||
modules: [ path.resolve(__dirname, "common", "node_modules") ],
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue