Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation - API use without wirecloud #12

Open
pabSec opened this issue Sep 26, 2019 · 1 comment
Open

Improve documentation - API use without wirecloud #12

pabSec opened this issue Sep 26, 2019 · 1 comment

Comments

@pabSec
Copy link

pabSec commented Sep 26, 2019

I would love to know how could it be used without Wirecloud, just as a proxy between Orion Context Broker and our custom react app.

How do we manage the Orion subscription from the proxy?

Thanks

@PanagiotisFlorous
Copy link

I am beyond late for this to be relevant for @pabSec but in case anyone else ends up watching this issue and needs an answer for this the documentation posted by @ammopt in #19 works great.

For my React application I managed to get dynamic updates from Stellio and re-render my dashboard using:

const [myState, setMyState] = useState(0)

useEffect(() => {
        const sse = new EventSource(
            "http://{ngsiproxyurl}/eventsource/08e19900-bf77-11ee-b2d3-5f8162a71691"
        );
        sse.addEventListener("notification", function (e) {
            const payload = JSON.parse(JSON.parse(e.data).payload);
            setMyState(payload.data[0].state.value);
        });
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants