Fork me on GitHub
#pedestal
<
2020-05-26
>
Joe Lane14:05:22

You can "leverage the interceptor model" by creating your own interceptor chain and run all onmessage events through said chain. Pedestal interceptors are NOT coupled to HTTP, I've used them with queues, my own domain logic, I've even seen them with kafka.

hlship20:05:19

We use them as wrappers around outgoing HTTP requests as well, to add logging/retries/QoS/encoding & decoding ...

mpenet14:05:29

lots of libs use that pattern now, it's basically an enhanced middleware pattern (open/modifiable stack/queue). There are also a few libs that make it usable with manifold, completablefutures, cljs etc (basically implementing their own chain runner, with some slight modifications sometimes, since it's not specified)

Joe Lane14:05:21

The difference between middleware and interceptors being functions vs data, respectively.

mpenet14:05:37

closure vs explicit context

mpenet14:05:43

but yes, kinda

Joe Lane14:05:57

I like your description more.

mpenet14:05:59

also interceptors you can modify on the fly the chain

mpenet14:05:18

then some impl re-wrap errors, some dont etc etc, small variations

hindol17:05:27

@joe.lane Thank you for the link. I really love the interceptor model. I find it much easier to wrap my head around than the middleware pattern. I have been looking at Sieppari for a general purpose interceptor chain but if Pedestal interceptors can be adapted, I will go with that instead.

👍 4
🚀 4
ddeaguiar21:05:24

FYI, I’ve created https://github.com/pedestal/pedestal/issues/659 to track the creation of a session-aware WebSocketListener impl

16
hindol06:05:24

If you are accepting PRs for this, I can help. (I am not an expert on frontend technologies though, so it would be good if someone can provide meaningful feedback.)