Hello,
It’s been a couple of years since we had to create a new Remoting SDK server. But now the time has come. I’ve seen that a lot of things has changed when I created a Remoting SDK server, for starters a Code First one is new for me.
I have to create a Remoting SDK Windows service to do 2 things:
- Send text messages (with an API with a bearer access token)
- Poll for new incoming text messages
I’ve seen a new object of the type ApplicationServer is created in the Main and a Service is created.
[Service, StandardClassFactory]
public class TextMessageService : Service
Now my (maybe stupid) questions but I like to learn how this new setup works exactly before using it blindly:
- When calling the SendTextMessage function of the TextMessageService from multiple clients, a new object of the TextMessageService type is always created (Why is that?), so caching my access token object in this ‘Service’ is a bad idea. What’s the best practice here? Caching it in a static class/object?
- What’s the best practice of running a function periodically (every minute or so) in this type of Code First Remoting server? A timer, and if so, where do I declare en initialize it? I’m used of using the ServiceBase class with a timer, but in a Code First Remoting server no such class is created so I’m kinda lost
Thank you for helping me out.
Greetings.