Hey,
I wrote a little module to use socket.io without pain. It verifies the token and used role permissions to decide when to emit events to user. You can install it via npm.
Hey,
I wrote a little module to use socket.io without pain. It verifies the token and used role permissions to decide when to emit events to user. You can install it via npm.
Hi @larsonnn, pardon my noob question, but is this module for creating notifications within Strapi?
Hello i install this module but i donāt find the file on api, maybe strapi developments delete?? greetings
strapio will emit some socketio messages. So when you mean by notifications that its sending socketio messages, yes.
Which file? StrapIO will be in your node_modules. You need to write some code yourself.
@larsonnn Iām wondering if building a middleware to emit the socket.io events might be better (maybe with a whitelist, could be cool to create a plugin or something for this )
the problem with middleware is the lack of information. AFAIK, you have not all information in middleware for validating if someone has the permission to receive the message etc. Its missing for example the controller information.
middleware has only context information. So far you would need to inject the needed information in custom controllers.
But maybe someone knows more.
I was playing around and just built a plugin for it lol: strapi-plugin-socket - npm
This is just a sample and I wonāt likely maintain it.
It would be nice if someone could maintain it.
Thanks for this great source.
Happy to hand the package and repo over to anyone who wants to maintain it, I only did it as a test honestly and there is a lot of extra features that could be added.
The only question i have here is that can you provide the server side example for emitting the message,
in STRAPIO we had to update bootstrapi.js and also add those emitting events in controllers where needed.
what do we do here ?
I hope this is not open and emits data on all CRUDS on all content types.
My example package does, but some feature could be added in a fork much like the strapi-middleware-cache package does. My plugin was only a POC and isnāt intended for actual usage.
Maybe we need a ālooking for maintainerā section in forum and discord.
@Saad_Mujeeb there is an upcoming PR in the project where you can configure endpoints.
But you should not use it in production yet, it has no maintainer and the code is not well tested.
I guess I will try to maintainā¦ Hope I get help soon.
I have renamed my fork to strapi-plugin-socket.io ā because its no websocket. And the name shouldnt confuse developers.
I will publish to npm soon
NPM: https://www.npmjs.com/package/strapi-plugin-socket.io
had to rename to: strapi-plugin-socket-io - npm
strapi cant import plugins with socket.<-dot
I have a question related to this: Will Strapi 4 support Graphql subscriptions?
No, not initially
It is one of the most strong features from GraphQL
and one of the feature we most miss from Amplify.
There are various reasons why it hasnāt been implemented yet, one big one is scaling and the fact we donāt have a valid/native way to connect up a memory database like Redis yet.
Itās coming, we just donāt have a date and the initial v4 is about massive refactoring to our backend (plus the new design system) and we are at our capacity for modifications that fit within our deadline.
Point is: We want to do a lot of stuff, but we are lacking in Devs and time that fit within our long term plan. Speaking of, if you know anyone we have lots of positions open and a lot more being opened soon:
STRAPIO v2 is out. Its subscribe only. You need to socket.emit(āsubscribeā, āarticleā) in your client to get the data.