Plugin - Doubt, is it possible to be done?

I am creating a plugin for kong and I am in doubt if it could be done.

What I need to do with this plugin is basically destroy, close, the connection after a given time (each connection has a different expiration time). I’m using a websocket.
Could this be done?

Thank you

I’m not sure but I don’t think this can be done.
@datong.sun @bungle can probably confirm here.

1 Like

Thank you very much, I will wait for their confirmation.

You can give body filter a try. Although if there is no data between the server and client it won’t be invoked anyway.

Likely this is not achievable with Lua.

Update: I looked into the ngx_http_upstream_process_upgraded function, it seems that WebSocket proxying bypasses the body filter completely (which kinda makes sense). So body filter won’t work either.

1 Like

Thank you for all the help, apparently it is not possible, right?

Thanks again

You could possibly terminate websocket in plugin and make the plugin make another websocket to upstream. I have always wanted to make that kind of plugin. E.g. websocket in, rest to upstream, which makes all the rest apis websocket apis too. But I have not went further with the idea. Or perhaps otherway around, rest in, and websockets to upstream.