How to handle responses from the Backend
See original GitHub issueI’m sorry if this sounds like a stupid question, but I’m just a hobby developer and kind of stuck here.
Regarding the classic example from the protocol (Authorize, StartTransaction, Authorize, StopTransaction), how can I handle the .conf responses from the charging stations ?
I have two seperate scripts as in the examples. The .req from the CP side works perfectly, but how can I handle the answer from the Charging Station ?
I initially thought on using @on(Action.BootNotification)
to catch the call_result.BootNotification on CP side, but nothing happens.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
3 Tips on API Responses for Backend Developers
Always return objects, consider not using JSON, do not filter out null values. Let's delve into these 3 tips on API responses for...
Read more >Fantastic Requests and How to Handle Them — A Backend ...
In our story, this works out fine and he receives the appropriate success answer (200 in real life, or a similar Success response)....
Read more >Dealing with Delayed Response from Backend - Forums - IBM
The case where one of back-end system is slow in responding to high request volumes can be addressed using SLM. You can fix...
Read more >How Does the Frontend Communicate with the Backend?
If a browser requests something like http://example.com/style.css , this is usually handled by the web server (like Nginx) of the backend. The request...
Read more >How the Web Works, HTTP Request/Response Cycle
Define the 'Vocabulary' of the web; Describe the Request/Response Cycle at a high level; Describe the parts ... The process would look something...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The
@after()
is a post request hook. It’s triggered by requests, not responses. Similar to the@on()
decorator, that is only triggered by requests too, not responses. Therefore, the suggestion from @proelke doesn’t work.Your code, @c0nr3f , works and makes sense to me. Although I suggest a small change: replace
asyncio.create_task(self.send_authorize())
withawait self.send_authorize()
.Using a fire and forget strategy of tasks using
asyncio.create_task()
is dangerous. Errors raised during it’s execution don’t bubble up to the caller.But then we are back at the question, how to handle the response from the backend. How would you code an Authorize call as a reaction to the BootNotification.conf ?