Ionic app like rest server

It’s possible to create ionic app like rest server. I want to create app which connects to the server . Then the application listens and the server call to app with request “do something”. I don’t want to call the server from the app every 5 seconds. Has anyone done something similar?
Sorry for my English.

What you are looking for should be Web Sockets

Thank you. Your solution should be good.
I wonder if there is a possibility to do from ionic app rest server, which will be able to call to methods from postman.

I found expressJs. Can I use it in ionic application? I tried to do something like that but not working:

import express from 'express';
const app = express();
      const port = 3000;

      app.get('/', (req, res) => res.send('Hello World!'));

      app.listen(port, () => console.log(`Example app listening on port ${port}!`));

Expected action:

server side send request to ionic application by ip address (for example and then ionic application response to sever ‘Hello World!’