Event subscriber class

Hi,
I would like to create my custom event subscriber class. I read wiki https://github.com/dreamfactorysoftware/dsp-core/wiki/Server-Side-Events#php-subscriber-examples especially part about custom php class. I have a problems with creating instance of my class - it’s never created. I add autoload.php in storage/.private/config but it’s never called too. Where is the on() method of the DSP’s main application instance?
I have dsp 1.8.0

What is the best technique write own server side event listener? In my case I would like to send messages to social networks (twitter, …) after successful post into my database table with formatted information from that table.

Thank you for your help.

The easiest way is to write a server side script (event script) for servicename.tablename.post.post_process.

This script is called after the POST request has been handled. You can then use the functions documented in the wiki to make calls to your social network services.

var payload = {"first_name": "joe", "last_name": "smith"};
var result = platform.api.post(twitterURL, JSON.stringify(payload));

https://github.com/dreamfactorysoftware/dsp-core/wiki/API-Access-via-Scripts

Thank you, I was looking for some advises for custom event subscriber scripts, but I decide to store information into db table and send it from cron task. Task is not synchronous, but in that case I think it is better.