Skip to content

Comments

Different changes#10

Open
Odianosen25 wants to merge 4 commits intobeebotte:masterfrom
Odianosen25:master
Open

Different changes#10
Odianosen25 wants to merge 4 commits intobeebotte:masterfrom
Odianosen25:master

Conversation

@Odianosen25
Copy link

@Odianosen25 Odianosen25 commented Nov 10, 2020

Been trying to get this client to work properly in the browser, and noticed there are a couple of things that will need fixing to complete it.

Added a warning when trying to subscribe and its not connected
While working, I had instances whereby I was trying to setup the connection, and then subscribe immediately. As I was trying different api keys, I had no idea of telling if the connection had been established or not. After some internal debugging, I figured out the reason it subscribed sometimes and didn't was because I was trying to subscribe before the connection was established; and there was no warning to tell me this. So why I added this.

Added the ability to subscribe to public channels
From all indications, it seems when using this client api, it is not allowed to subscribe to publish channels. Since I have to auth_endpoint yet in my application, I cannot work with private for now (unless I am wrong), and why I added the ability to instruct it using the is_public key, so it will allow to make use of public channels as well

Added a key check when using empty string
When I used an empty string as api key, it seemed to be it had connected and I couldn't tell if it had or not due to no enough information being sent to console to tell. So this helps with that

Added setting on connection callback feature
Initially when I was working with this api, as I was connecting and trying to subscribe immediately, it wasn't working as I really had no way to know if it had connected or not. Within the bbt.js file, it does have an onConnection callback, but this was no available for one to use for other things (unless I am wrong, so forgive my noob level ;)). So added the ability to specify a callback, which will be ran when a connection is made. This will then allow the user to do other things which needs connection like subscribe to channels and all.

Added setting on disconnection callback feature
Similar to the above but for disconnection this time. Even internally this was disregarded, so had to add it so users can use the callback to do other stuffs when writting code

Disable auto connect by default
Auto connecting by default, didn't allow for time to do other things before the connection is made, like specifying an on_connect or on_disconnect callback

Added the ability to set if the channel is public or not using is_public
This became necessary as it seems the client api is only designed to connect to private channels, when the write is enabled. I can understand the reason for extra security, but not everyone has all the backend infrastructure to setup the connection endpoint. Besides my app is to run in standalone mode as a PWA, so there is no way I will be using an authentication url

Fix for a few bugs

  • Fixed jquery authentication
  • Fixed error returned when authenticating

Documentation will need more explanation in general, if my PR is accepted and will be willing to help with that.

Regards

Been trying to get this client to work properly in the browser, and noticed there are a couple of things that will need fixing to complete it.

- Added a warning when trying to subscribe and its not connected
- Added the ability to subcribe to public channels
- Added a key check when using empty string
- Disable auto connect by default
- Added setting on connection callback feature
- Added setting on disconnection callback feature
- Added the ability to set if the channel is public or not using `is_public`

Regards
Updated the query authentication mechanism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant