Important: Please read the Qt Code of Conduct -

QT HTTP Server

  • Hi Guys
    This question is very broad so apologies in advance but you may be able to advise.

    I have my C++ QT application running on a Windows machine.
    On the same machine is a separate 3rd party software package that can send out a JSON event.
    This 3rd party app requires a URL to send the event to.

    What would be the simplest way for the my QT C++ application to receive this JSON event as I would like to do this locally.
    Would the best way be to create a QT HTTP server within my C++ QT Application?
    Or is there a better way do you think?

  • Lifetime Qt Champion

    @celica said in QT HTTP Server:

    This 3rd party app requires a URL to send the event to


  • @jsulm The protocol used can be any of the following:

  • Lifetime Qt Champion

    @celica What is not clear to me: is your application going to connect to this 3rd party software? So, who in this setup is the server? I would expect the app sending events to be the server and other apps interested in these events would connect to it.

  • @jsulm I suppose that's my question.
    The 3rd party software needs a URL of a server.
    I have already entered a remote server URL and connected to it and verified the JSON events so everything works fine,

    However going forward I don't want to use a remote server for rollout so looking for the simplest way to link the 3rd party app and my QT app.
    I could setup a local apache/mysql/php server. But I really don't want to setup an AMP server.
    Just there might be a simpler solution.

  • Lifetime Qt Champion

  • @jsulm Thank you, ill have a read

  • @celica said in QT HTTP Server:

    The 3rd party software

    Could it be possible to know the name of such 3rd party software? unless it's top secret...

    needs a URL of a server.

    As @jsulm already asked, is that application doing periodic HTTP POST requests to such server?

  • @Pablo-J-Rogina Nope not top secret just trying to not clutter up the question too much.
    It is camera analytic software by Gorilla.
    You can set up a camera to trigger on a specific event, lets say a human intrusion event into a specific zone of the camera feed.
    As well as storing the event details locally you can subscribe to receive the event via JSON or QML format, through SMPT, HTTP or HTTPS protocol.

    So at the moment it will trigger when a human is detected in a zone for longer period of 5 seconds.
    This scenario at the moment will not generate many events.
    I just need to receive the data into my QT C++ app.
    The data looks like this:

    {source={ivarId={f1d22827-1650-41a0-a31e-28621430bc7d}, channel=1}, common={type=AUDIT_LOG, time=2020-04-20T15:40:11.256Z}, auditLog={clientId=2148, clientIp=, account=, command=START_LIVE, parameters=[{name=channelId, value=1}, {name=answer, value=1}, {name=replyType, value=1}], result=STATUS_OK}, id={be138cc4-321c-41a9-8d2f-25a1e5d058fc}, addInfo={ivarIp=}, images=[]}

  • @celica said in QT HTTP Server:

    You can set up a camera to trigger on a specific event

    Ok, that makes more sense now... So as @jsulm suggested you may want to take a look at the Qt HTTP Server component.

    Check for instance the httpserver example, look at the way you can define "routes", so there you can parse the JSON data received (using Qt JSON support), and action based on that event (store on disk, etc.)

  • @Pablo-J-Rogina Thanks a lot, will do.

Log in to reply