A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ably-forks/laravel-echo below:

ably-forks/laravel-echo: Laravel Echo library for beautiful Pusher and Ably integration.

This repository is a fork of https://github.com/laravel/echo. It adheres to public interface methods from base repository. It will be synced regularly with the base repository to make sure all the code is up to date. Ably-specific implementation is added to support native ably-js.

Install @ably/laravel-echo (wrapper for pluggable lib) and latest version of ably (pluggable lib) using npm.

npm install @ably/laravel-echo ably@1.x

Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. A great place to do this is at the bottom of the resources/js/bootstrap.js file that is included with the Laravel framework. By default, an example Echo configuration is already included in this file; however, the default configuration in the bootstrap.js file is intended for Pusher. You may copy the configuration below to transition your configuration to Ably.

import Echo from '@ably/laravel-echo';
import * as Ably from 'ably';

window.Ably = Ably; // make globally accessible to Echo
window.Echo = new Echo({
    broadcaster: 'ably',
});

window.Echo.connector.ably.connection.on(stateChange => {
    if (stateChange.current === 'connected') {
        console.log('connected to ably server');
    }
});
    broadcaster: 'ably',
    authEndpoint: '/broadcasting/auth' // relative or absolute url to laravel-server
    broadcaster: 'ably',
    // ably specific client-options
    echoMessages: true, // self-echo for published message is set to false internally.
    queueMessages: true, // default: true, maintains queue for messages to be sent.
    disconnectedRetryTimeout: 15000, // reconnect after 15 seconds when client goes disconnected state
    suspendedRetryTimeout: 30000, // reconnect after 30 seconds when client goes suspended state

Once you have uncommented and adjusted the Echo configuration according to your needs, you may compile your application's assets:

Working with laravel sanctum/ support channel auth using custom implementation
    echo = new Echo({
            broadcaster: 'ably',
            useTls: true,
            requestTokenFn: async (channelName: string, existingToken: string) => {
                let postData = { channel_name: channelName, token: existingToken };
                const res = await axios.post("/api/broadcasting/auth", postData);
                return res.data;
            },
    });
Observing channel messages on ably dev-console and Leaving the channel
//public channel
let echoPublicChannel = Echo.channel('channel1');
let ablyPublicChannelName = echoPublicChannel.name;
console.log(ablyPublicChannelName); // public:channel1

// private channel
let echoPrivateChannel = Echo.private('channel2');
let ablyPrivateChannelName = echoPrivateChannel.name;
console.log(ablyPrivateChannelName); // private:channel2

// presence channel
let echoPresenceChannel = Echo.join('channel3');
let ablyPresenceChannelName = echoPresenceChannel.name;
console.log(ablyPresenceChannelName); // presence:channel3
Echo.leaveChannel(echoPublicChannel.name);
Echo.leaveChannel(echoPrivateChannel.name);
Echo.leaveChannel(echoPresenceChannel.name);
Success/failure confirmation for whisper
        echoPrivateChannel.subscribed(() => {
                echoPrivateChannel.whisper('msg', 'Hello there jonny!', (err) => {
                    if(err) {
                        console.log('whisper failed with error ' + err);
                    } else {
                        console.log('whisper succeeded');
                    }
                });
            });
  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Ensure you have added suitable tests and the test suite is passing (run vendor/bin/phpunit)
  5. Push to the branch (git push origin my-new-feature).
  6. Create a new Pull Request.

This library uses semantic versioning. For each release, the following needs to be done:

  1. Create a new branch for the release, named like release/1.0.3 (where 1.0.3 is what you're releasing, being the new version).
  2. Update the LIB_VERSION in src/connector/ably-connector.ts.
  3. Update version in pakckage.json.
  4. Run github_changelog_generator to automate the update of the CHANGELOG-ABLY.md. This may require some manual intervention, both in terms of how the command is run and how the change log file is modified. Your mileage may vary:
  1. Commit generated CHANGELOG-ABLY.md file at root.
  2. Make a PR against main.
  3. Once the PR is approved, merge it into main.
  4. Add a tag and push it to origin - e.g.: git tag ably-echo-1.0.3 && git push origin ably-echo-1.0.3.
  5. Publish npm package on npmjs.com.
  6. Visit https://github.com/ably-forks/laravel-echo/tags and add release notes to the release (generally you can just copy the notes you added to the CHANGELOG).
  7. Update the Ably Changelog (via headwayapp) with these changes (again, you can just copy the notes you added to the CHANGELOG).

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4