Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

README.md

HTTP GRIP library for .NET

This library implements the Generic Realtime Intermediary Protocol (GRIP), used by Pushpin and Fanout.io to deliver realtime pushes to HTTP clients.

Copyright (c) RealCrowd, Inc. All rights reserved. See LICENSE in the project root for license information.

Background

Usage

To subscribe an incoming HTTP request to a channel:

using System.Text;
using System.Net.Http;

public HttpResponseMessage Get()
{
  var instruct = new RealCrowd.Grip.Instruct();
  instruct.CreateResponseHold(
    "test-channel", // channel to subscribe to
    null,           // id of previous publish (optional)
    "text/plain",   // timeout content type
    "(no data)\n"); // timeout body
  var response = new HttpResponseMessage(HttpStatusCode.OK);
  response.Content = new StringContent(instruct.ToString(), Encoding.UTF8,
    "application/grip-instruct");
  return response;
}

To publish an HTTP response on a channel:

using System.Net.Http;

var publishControl = new RealCrowd.Grip.GripPublishControl("http://localhost:5561");
var responseFormat = new HttpResponseFormat(
  "text/plain",     // publish content type
  "hello world\n"); // publish body
await publishControl.PublishAsync(
  "test-channel",   // channel to publish on
  null,             // id of publish (optional)
  null,             // id of previous publish (optional)
  responseFormat);

About

No description, website, or topics provided.

Resources

License

Releases

No releases published
You can’t perform that action at this time.