Dev Q — barebones serverside example

I’d like to build a barebones application that can receive data from a speckle stream in a server context. It seems like most of the Speckle.Core API operates on the assumption that it’s executing on the same machine as the SpeckleManager is installed, so it can draw on locally stored auth, account management, etc. I’ve been struggling to figure out how to get things up and running in a context without the SpeckleManager.

Eventually I’ll move to having some kind of clean auth flow, but for now ideally I should just be able to consume some minimum set of information (a user token, a server url, a stream id, or whatever) as strings, and then be able to access the stream. Are there any examples that work this way for me to start from?

3 Likes

Hey @Andrew ,

The .NET SDK has been designed to be used primarily with SpeckleManager, but it’s possible to also use it without.

For example, see the code below:

using Speckle.Core.Api;
using Speckle.Core.Credentials;
using System;

namespace SpeckleSampleApp
{
  class Program
  {
    static void Main(string[] args)
    {
      var account = new Account();
      account.token = "YOUR-PERSONAL-ACCESS-TOKEN";
      account.serverInfo = new ServerInfo
      {
        url = "https://speckle.xyz/"
      };

      var client = new Client(account);
      var stream = client.StreamGet("5dfbeb49c9").Result;
    }
  }
}


You can generate personal access tokens from your Speckle profile page.

This is of course only one way, there are more! Especially if using Python or JS.

Any more questions just ask! I’ll make sure to update our docs with this little sample :slight_smile:

EDIT:

I think a nice addition to Core would be an overload for the Client constructor to directly take token and server url.

3 Likes

schweeeeeet! thanks! will give it a try

2 Likes