0

I am trying to use Forge Webhooks API to monitor the translation progress of my model with Model Derivative API. I use :

  • C# Web ApiControllers on server side
  • jQuery/JS on client side

I am not sure about where to handle callbacks from Webhooks API. I started writting the callback receiver in the C# ApiController (server side) :

    [HttpPost]
    [Route("api/webhook/callback")]
    public HttpResponseMessage WebhookCallback(dynamic info)
    {
        string urn = info.resourceUrn;

        // do things

        // redirect to root
        HttpResponseMessage res = Request.CreateResponse(HttpStatusCode.Moved /* force redirect */);
        res.Headers.Location = new Uri("/", UriKind.Relative); // back to / (root, default)

        return res;
    }

But then I realized I can't execute JS client side functions from this Controller method, for instance to show the model in the viewer.

Do I need to write the callback receiver in the JS client side part? If so, how?

Thanks in advance for your help.

M.V.
  • 177
  • 9

1 Answers1

0

The webhook need to call a stable URL, so on your server side, which then calls your client side (e.g. using websocket )

We have a .NET sample here, sorry it doesn’t yet implement the websocket

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
  • Would you advise SignalR for websocket implementation ? I'm afraid my prod server will be on Windows Server 2008 R2, so it won't support websockets. – M.V. Oct 10 '18 at 13:50
  • seems possible from what I read at https://www.asp.net/signalr, there is no limitation or restrictions from Forge on this, you can choose the best technology/library for it – Augusto Goncalves Oct 10 '18 at 15:11
  • 1
    In Supported platforms section, you can read "Note that for SignalR to use WebSockets, Windows Server 2012, Windows Server 2016, or Windows 8 is required". – M.V. Oct 11 '18 at 08:39