Skip to content
Browse files

Added an overload to Send that allows passing an object.

  • Loading branch information...
1 parent 5888d8c commit 9c171bd8e77f79755aa43a14d0e5ab77e9e50e4a @davidfowl davidfowl committed Jun 22, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 SignalR.Client/Connection.cs
View
11 SignalR.Client/Connection.cs
@@ -6,6 +6,7 @@
using System.Net;
using System.Reflection;
using System.Threading.Tasks;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SignalR.Client.Http;
using SignalR.Client.Transports;
@@ -325,6 +326,16 @@ public Task Send(string data)
return ((IConnection)this).Send<object>(data);
}
+ /// <summary>
+ /// Sends an object that will be JSON serialized asynchronously over the connection.
+ /// </summary>
+ /// <param name="value">The value to serialize.</param>
+ /// <returns>A task that represents when the data has been sent.</returns>
+ public Task Send(object value)
+ {
+ return Send(JsonConvert.SerializeObject(value));
+ }
+
Task<T> IConnection.Send<T>(string data)
{
if (State == ConnectionState.Disconnected)

0 comments on commit 9c171bd

Please sign in to comment.
Something went wrong with that request. Please try again.