Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zhangyaoxing/socketevent.net

.NET SDK for my project SocketEvent
https://github.com/zhangyaoxing/socketevent.net

Last synced: about 1 month ago
JSON representation

.NET SDK for my project SocketEvent

Awesome Lists containing this project

README

        

SocketEvent.NET
===============
.NET SDK for my project SocketEvent

How to use
===============
- Connect to a server

```c#
var client = new SocketEventClient(id, url);
```

id: is a string identifier to indicate who the client is.
url: SocketEvent server address.

- Subscribe

```c#
SocketEventClient.Subscribe(
"EventName",
new Func(
(request) =>
{
// what do you want to do when event triggered.
return RequestResult.Success;
}),
(response) =>
{
// event subscription succeeded.
});
```

- Enqueue

Trigger an event

```c#
using (var client = new SocketEventClient(id, url))
{
client.Enqueue(
"EventName",
1, // try time(s)
60, // timeout
new
{
// dynamic object which you can use to pass some parameters.
},
(response) =>
{
// enqueue succeeded.
});

result = ResponseFactory.CreateInstance(
ResponseStatus.Success,
null,
true);
}
```