-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create bundle for message-bus-ajax #234
Comments
This looks related to chunked encoding. What browser are you using? What does your setup look like. Payload is correct in that, this is how chucked encoding payloads are transported. |
brave Version 1.13.82 Chromium: 85.0.4183.83 (Official Build) (64-bit) it is a
# config/initializers/message_bus.rb
Rails.application.config do |config|
# See https://github.com/rails/rails/issues/26303#issuecomment-442894832
CustomMessageBusMiddleware = Class.new(MessageBus::Rack::Middleware)
config.middleware.delete(MessageBus::Rack::Middleware)
config.middleware.insert_after(Warden::Manager, CustomMessageBusMiddleware)
end
MessageBus.configure(backend: :redis, url: "redis://#{ENV['REDIS_HOST']}:#{ENV['REDIS_PORT']}/0", namespace: ENV['REDIS_NAMESPACE']) in the js client just import MessageBus from 'message_bus'
MessageBus.start();
MessageBus.callbackInterval = 500;
MessageBus.subscribe('/channel', (data) => {
console.log(data)
})
|
Any news about this ?
As i mentioned in the issue description, copying and pasting in my project the 2 files Also the npm page shows that the last release was 3 years ago At the same time the /assets/message-bus.js history shows that the last changes happened 1 month ago: So my question here is: is it possible that the |
Oh this is a concern, I am guessing you are talking about a completely different npm package to the one @eviltrout published. @smikhalevski appears to own this thing and is not associated with this project |
https://www.npmjs.com/package/message-bus-client is our official npm package. |
closing this @nic-lan as you appear to be using an unofficial npm package. |
Sorry @SamSaffron it took me a bit longer to answer I changed the package to the official https://www.npmjs.com/package/message-bus-client as you suggested but now i am facing another error. In particular I don't have the JQuery installed in my app so i receive:
That makes sense because i did not required Can it be that the additional ajax adapter is missing and must be added to the package ? |
This makes sense, yeah we should get message-bus-ajax into our bundle. (or make an optional bundle for it) |
Hei hei |
@nic-lan we will get to this. @eviltrout what are your thoughts here, just add the optional -ajax file here: Line 8 in 12dd450
|
For Discourse's usage we already have jQuery ajax, so I wouldn't want to include it in the jsnext package. It would probably be better to create a new npm module for it to add the ajax function. Another alternative would be to swap it out for the |
I think chunked encoding is pretty experimental in the fetch API https://web.dev/fetch-upload-streaming/ we could just use raw XMLHttp though and provide hooks so jQuery can override, not sure. |
In that case I think the second module on npm is the way to go. |
hei hei... |
I hear you @nic-lan it is just this is so low on my priority list. Maybe @eviltrout can add to his list but I would not expect this to be done for at least a few more months. For the time being can you just cut and paste the 20 lines of JS into your project? |
I have installed message_bus by doing
and now in my package.json i can see the package version installed
"^2.0.3-beta.2"
in the js i do :
and in the console when a event is published to the channel i receive the following error:
If i understand correctly the issue is generated here
after some investigation i can see that the issue is message-bus.js:257
where
which does not look very good to me.
Note
Also the javascript in this repo is different from what i see in the package installed with yarn.
To make a test i just tried to copy-paste the original source of the javascript in the repo and it worked as expected so i guess that the fix here is just release the right version of the javascript client in the npm or wherever is stored
:-)
The text was updated successfully, but these errors were encountered: