Skip to content

Commit

Permalink
adding, example for filter
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneberger committed Oct 19, 2022
1 parent 5ec4332 commit 1b42df9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,17 @@ Service which filters and sends out data to all listening clients over websocket
- **WEBSOCKET_PORT**: mendatory under which port the websocket port runs


### Filter


```json
{
"lines": [9, 11],
"positions": [],
"regions": [0]
}
```

This would only let telegrams from line 9 and 11 from region 0 (dresden). This Json
just needs to be send to the websocket sending it again will overwrite the previous filter.

1 change: 0 additions & 1 deletion src/filter.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#ifndef FUNNEL_FILTER_HPP
#define FUNNEL_FILTER_HPP

Expand Down
22 changes: 22 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3.9 -p "python39.withPackages(ps: with ps; [ websockets ])"

import asyncio
import json
from websockets import connect

config = {
"regions": [0, 1],
}

raw_config = json.dumps(config);

async def hello(uri):
async with connect(uri) as websocket:
await websocket.send(raw_config)
while True:
print(await websocket.recv())
#await websocket.pong()

asyncio.run(hello("wss://socket.staging.dvb.solutions"))
#asyncio.run(hello("ws://127.0.0.1:9001"))

0 comments on commit 1b42df9

Please sign in to comment.