Raspyberry pi act as a websocekt

Hello friends.

In my project i get data from a PLC. A friend of mine is working with me on this project. He is doing the webdev.-stuff. He said he has done his part and set up a cloud, a login etc and that he now needs the json file. He told me for this my pi must act as a websocket so he can fetch the json file from it and work further with the data to diplay them on the page. In the next step we want to control our device via the website. So i read its best to initiate the websocket directly in node red

He needs the ip and the path from where he can get the jsonfile.

I am now a bit overwhelmed hot to achive this. From my research i think the websocket node is the way to go. Maybe someone can help me to find the right direction?

Thank you very much

[
    {
        "id": "e3e4522e.1c1bb",
        "type": "inject",
        "z": "0c822967e78b69a8",
        "name": "Tick every 5 secs",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "topic": "test",
        "payload": "",
        "payloadType": "date",
        "x": 570,
        "y": 1860,
        "wires": [
            [
                "45dbf990.ba2408"
            ]
        ]
    },
    {
        "id": "50da04b3.af25fc",
        "type": "websocket out",
        "z": "0c822967e78b69a8",
        "name": "",
        "server": "985ecbc7.67a138",
        "client": "",
        "x": 970,
        "y": 1860,
        "wires": []
    },
    {
        "id": "45dbf990.ba2408",
        "type": "function",
        "z": "0c822967e78b69a8",
        "name": "format time nicely",
        "func": "msg.payload = Date(msg.payload).toString();\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 770,
        "y": 1860,
        "wires": [
            [
                "50da04b3.af25fc"
            ]
        ]
    },
    {
        "id": "eccc8bc2.133378",
        "type": "websocket in",
        "z": "0c822967e78b69a8",
        "name": "",
        "server": "985ecbc7.67a138",
        "client": "",
        "x": 757,
        "y": 1912,
        "wires": [
            [
                "9adfff59.652"
            ]
        ]
    },
    {
        "id": "9adfff59.652",
        "type": "debug",
        "z": "0c822967e78b69a8",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 947,
        "y": 1912,
        "wires": []
    },
    {
        "id": "985ecbc7.67a138",
        "type": "websocket-listener",
        "z": "0c822967e78b69a8",
        "path": "/ws/simple",
        "wholemsg": "false"
    }
]

I found this example. From what i see, is it kinda the stuff what i need.

I somehow must connect now to the cloudserver and let him "fetch" the jsonfile.

sorry for my stupid questions. i am a noob

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.