public SpeckleReceiver(string apiUrl, string token, string streamId, SpeckleConverter _converter, string documentId = null, string documentName = null)
        {
            converter = _converter;

            server          = new SpeckleServer(apiUrl, token, streamId);
            server.OnError += (sender, e) =>
            {
                this.OnError?.Invoke(this, new SpeckleEventArgs(e.EventInfo));
            };

            server.OnReady += (sender, e) =>
            {
                this.setup();
            };
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new sender from a previously serialised one.
        /// </summary>
        /// <param name="serialisedObject"></param>
        public SpeckleSender(string serialisedObject, SpeckleConverter _converter)
        {
            dynamic description = JsonConvert.DeserializeObject(serialisedObject);

            server = new SpeckleServer((string)description.restEndpoint, (string)description.token, (string)description.streamId);


            this.server.OnError += (sender, e) =>
            {
                this.OnError?.Invoke(this, new SpeckleEventArgs(e.EventInfo));
            };

            this.server.OnReady += (sender, e) =>
            {
                this.setup();
            };

            converter = _converter;
            converter.encodeObjectsToNative  = description.encodeNative;
            converter.encodeObjectsToSpeckle = description.encodeSpeckle;
        }