diff --git a/CollabVMSharp/CollabVMClient.cs b/CollabVMSharp/CollabVMClient.cs index 504a441..d504632 100644 --- a/CollabVMSharp/CollabVMClient.cs +++ b/CollabVMSharp/CollabVMClient.cs @@ -476,10 +476,12 @@ public class CollabVMClient { /// /// Send a raw string message over the socket /// - public Task SendMsg(string msg) { - if (!this._connected) throw new WebSocketException("Cannot send a message while the socket is closed"); - return this.socket.SendAsync(new ArraySegment(Encoding.UTF8.GetBytes(msg)), WebSocketMessageType.Text, + public async Task SendMsg(string msg) + { + if (!this._connected) return false; + await this.socket.SendAsync(new ArraySegment(Encoding.UTF8.GetBytes(msg)), WebSocketMessageType.Text, true, CancellationToken.None); + return true; } /// /// Request a list of VMs from the server.