diff --git a/Samples/ClientJs/Program.cs b/Samples/ClientJs/Program.cs index ce3977a..0f2fa5f 100644 --- a/Samples/ClientJs/Program.cs +++ b/Samples/ClientJs/Program.cs @@ -6,13 +6,29 @@ namespace TestClientJs { + /// + /// Remote API. + /// interface IRemoteAPI { + /// + /// Writes progress. + /// + /// Progress value [0..1]. void WriteProgress(float progress); } + /// + /// Local API. + /// class LocalAPI { + /// + /// Executes long running addition task. + /// + /// First number. + /// Second number. + /// Result. public async Task LongRunningTask(int a, int b) { for (var p = 0; p <= 100; p += 5) @@ -25,7 +41,7 @@ public async Task LongRunningTask(int a, int b) } } - public class Program + class Program { //if access denied execute: "netsh http delete urlacl url=http://+:8001/" //open Index.html to run the client diff --git a/Samples/ClientJs/ServerClientJs.csproj b/Samples/ClientJs/ServerClientJs.csproj index ad5aaee..82638f2 100644 --- a/Samples/ClientJs/ServerClientJs.csproj +++ b/Samples/ClientJs/ServerClientJs.csproj @@ -22,6 +22,7 @@ prompt 4 false + bin\ClientJs.xml pdbonly @@ -31,6 +32,7 @@ prompt 4 false + bin\ClientJs.xml diff --git a/Samples/MultiService/MultiService.csproj b/Samples/MultiService/MultiService.csproj index 6eceac2..b8ab050 100644 --- a/Samples/MultiService/MultiService.csproj +++ b/Samples/MultiService/MultiService.csproj @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + bin\ClientJsMultiService.xml pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + bin\ClientJsMultiService.xml diff --git a/Samples/MultiService/Program.cs b/Samples/MultiService/Program.cs index 58dbb13..6d3c5e7 100644 --- a/Samples/MultiService/Program.cs +++ b/Samples/MultiService/Program.cs @@ -8,7 +8,7 @@ namespace ClientJsMultiService /// /// Numeric service providing operations on numbers. /// - public class NumericService + class NumericService { /// /// Adds two numbers. @@ -25,7 +25,7 @@ public int Add(int a, int b) /// /// Text service providing operations on strings. /// - public class TextService + class TextService { /// /// Concatenates two strings. @@ -39,7 +39,7 @@ public string Add(string a, string b) } } - public class Program + class Program { //if access denied execute: "netsh http delete urlacl url=http://+:8001/" //open Index.html to run the client diff --git a/Samples/Serialization/Program.cs b/Samples/Serialization/Program.cs index 3062666..4d3f977 100644 --- a/Samples/Serialization/Program.cs +++ b/Samples/Serialization/Program.cs @@ -38,7 +38,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist /// /// The image processing service API. /// - public class ImageProcessingAPI + class ImageProcessingAPI { const int CHANNEL_COUNT = 3; diff --git a/Samples/ServerClientSample/Client/Program.cs b/Samples/ServerClientSample/Client/Program.cs index beb9815..5f3f575 100644 --- a/Samples/ServerClientSample/Client/Program.cs +++ b/Samples/ServerClientSample/Client/Program.cs @@ -6,12 +6,12 @@ namespace TestClient { - public interface ILocalAPI + interface ILocalAPI { Task LongRunningTask(int a, int b); } - public class RemoteAPI //:IRemoteAPI + class RemoteAPI //:IRemoteAPI { public void WriteProgress(float progress) { diff --git a/Source/WebSocketRPC.JS/ClientAPIBase.js b/Source/WebSocketRPC.JS/ClientAPIBase.js index fdfe3d7..73e1c41 100644 --- a/Source/WebSocketRPC.JS/ClientAPIBase.js +++ b/Source/WebSocketRPC.JS/ClientAPIBase.js @@ -83,6 +83,16 @@ function onMessage(msg, onError) */ this.connect = function (onOpen, onError, onClose) { + if (!!onOpen === false || typeof onOpen !== 'function') + throw 'OnOpen function callback is missing.'; + + if (!!onError === false || typeof onError !== 'function') + throw 'OnError function callback is missing.'; + + if (!!onClose === false || typeof onClose !== 'function') + throw 'OnClose function callback is missing.'; + + if (!!window.WebSocket === false) onError({ id: -1, title: "SOCKET_NOSUPPORT", summary: "This browser does not support Web sockets." }); @@ -146,7 +156,7 @@ this.onOtherMessage = null; this.send = (msg) => ws.send(msg); /* - * CLoses the underlying websocket connection. + * Closes the underlying websocket connection. * @param {number} - Status code (see https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes for details). * @param {string} - Human readable close reason (the max length is 123 bytes / ASCII characters). */