ClientMessage.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #if !BESTHTTP_DISABLE_SIGNALR
  2. using System;
  3. using BestHTTP.SignalR.Hubs;
  4. namespace BestHTTP.SignalR.Messages
  5. {
  6. /// <summary>
  7. /// This struct represents a message from the client.
  8. /// It holds every data and reference needed to construct the string represented message that will be sent to the wire.
  9. /// </summary>
  10. public struct ClientMessage
  11. {
  12. /// <summary>
  13. /// Reference to the source Hub. The Name and the State of the hub will be user.
  14. /// </summary>
  15. public readonly Hub Hub;
  16. /// <summary>
  17. /// Name of the method on the server to be called.
  18. /// </summary>
  19. public readonly string Method;
  20. /// <summary>
  21. /// Arguments of the method.
  22. /// </summary>
  23. public readonly object[] Args;
  24. /// <summary>
  25. /// Unique id on the client of this message
  26. /// </summary>
  27. public readonly UInt64 CallIdx;
  28. /// <summary>
  29. /// The delegate that will be called when the server will sends a result of this method call.
  30. /// </summary>
  31. public readonly OnMethodResultDelegate ResultCallback;
  32. /// <summary>
  33. /// The delegate that will be called when the server sends an error-result to this method call.
  34. /// </summary>
  35. public readonly OnMethodFailedDelegate ResultErrorCallback;
  36. /// <summary>
  37. /// The delegate that will be called when the server sends a progress message to this method call.
  38. /// </summary>
  39. public readonly OnMethodProgressDelegate ProgressCallback;
  40. public ClientMessage(Hub hub,
  41. string method,
  42. object[] args,
  43. UInt64 callIdx,
  44. OnMethodResultDelegate resultCallback,
  45. OnMethodFailedDelegate resultErrorCallback,
  46. OnMethodProgressDelegate progressCallback)
  47. {
  48. Hub = hub;
  49. Method = method;
  50. Args = args;
  51. CallIdx = callIdx;
  52. ResultCallback = resultCallback;
  53. ResultErrorCallback = resultErrorCallback;
  54. ProgressCallback = progressCallback;
  55. }
  56. }
  57. }
  58. #endif