Hi all
We have recently been talking to Johan Mulder about the possibilities/needs for REST support in XSockets.
Since we think that this is a good idea we have started the work around implementing such a protocol module.
Basically this means that you can to HTTP GET/POST to XSockets controllers just like you would do in MVC/WebAPI etc.
You will still get the same security and data returned from the controller method will be sent back as a HTTP response.
You will (of course) not be able to target clients that use the HTTP GET/POST with pub/sub and rpc such as InvokeTo and PublishTo, but you can still target clients with full-duplex connections from the method called with the REST API.
A simple example.
We have a PersonController with a method Get
public class PersonController : XSocketController
{
public async Task<Person> Get()
{
// create fake data
var p = new Person { Age = 39, Name = "Uffe" };
// send to all full-duplex clients in browsers, apps, systems etc
await this.InvokeToAll(p, "person");
// return to caller, can be both a full-duplex client or a REST client.
return p;
}
}
Below is a image where Putty is connected to the Person controller, and then there is a REST GET call made from POSTMAN.
As you can see the Putty client got the data, and POSTMAN also got the data from a HTTP response.
The possibility to use REST calls will be added as a experimental feature in the next release, and if you do not want the feature enabled you can just remove the assembly named "XSockets.Protocol.Http.dll"
Regards, Uffe
Team XSockets.NET