Giter Site home page Giter Site logo

docs's Introduction

date title layout permalink
2021-08-01
Readme
readme.njk
docs/README/

Pusher docs readme

An Eleventy powered static site using our custom Tachyons build with Postcss for styling.

It’s deployed and hosted by Vercel when the main branch changes using their Github integration - https://pusher-docs.vercel.app

Running locally

  1. Checkout the repo
git checkout [email protected]:pusher/docs.git
  1. Install the dependencies via yarn
yarn install
  1. Run Eleventy in development mode
yarn run dev

Eleventy watches for any changes and recompiles automatically, it uses BrowserSync behind the scenes to refresh the browser.

Compiling the CSS

If you’ve just checked out the repo, you’ll need to generate the css. You can also leave this running if you intend to change the CSS as you go, it will recompile and 11ty will pick up the changes and reload.

yarn run css

Search

Search is powered by Algolia, on every production build a refreshed index of all content is sent to them.

For users without JS there is a fallback page which is powered by Vercel’s serverless functions.

If you need to debug this you can run the project with vercel dev and it will hot reload any changes.

How to add / update new pages

  1. Add a new Markdown file in the relevant directory or edit an existing one.
  2. Add YAML front matter to the top. This should include an approved title and description and the creation date. If making a change be sure to update the date. For example:
---
date: 2021-08-23
title: Connection — Channels — Pusher Docs
layout: channels.njk
description: Optionally set this to override generated one
eleventyNavigation:
  parent: Using Channels
  key: Connection
---
  1. Write up your docs, you can use Markdown, HTML or Nunjucks. Although it’s best to keep it simple and stick to Markdown where possible.

It’s worth having a quick read of this CSS Tricks post about words to avoid

Advanced formatting

Code blocks

Add the language name just after the triple backticks to get syntax highlighting. We use Prism, the full list of supported languages is here.

Tabbed snippets

Sometimes it’s useful to provide multiple snippets of the same example code in multiple languages. For this we need to sprinkle a little Nunjucks to get things to work. We have a snippets shortcode for this.

To use it open a snippets block and pass an array of languages that matches the markdown code blocks within. Empty lines must be between the nunjucks and markdown code blocks.

{% raw %}

{% snippets ['js', 'rb'] %}

```js
const func = (x) => x^2;
```

```rb
def func(x)
  x^2
end
```

{% endsnippets %}

{% endraw %}

Which will render like this

{% snippets ['js', 'rb'] %}

const func = (x) => x ^ 2;
def func(x)
  x^2
end

{% endsnippets %}

Conditionally showing content when the snippet language is changed

You can change other content when the snippet changed to do this you must add a boolean to the snippet declaration and wrap in container

{% raw %}

{% snippets ['js', 'swift', 'laravelecho'], true %}

```js
pusher.unsubscribe(channelName);
```

```swift
[self.pusher unsubscribeFromChannel:channel];
```

```js
Echo.leaveChannel(channelName);
```

{% endsnippets %}

#### Parameters

{% parameter 'channelName', 'string', true, 'js,laravelecho' %}

The name of the channel to unsubscribe from.

{% endparameter %}

{% parameter 'channel', 'PTPusherChannel', true, 'swift', false %}

The name of the channel to unsubscribe from.

{% endparameter %}
{% endmethodwrap %}

{% endraw %}

Parameter shortcode syntax

Parameters

{% parameter 'name', 'String', true %}

The name of the parameter

{% endparameter %}

{% parameter 'type', 'String', false %}

Can be either:

  • A string detailing the type like object or string
  • or null if you don’t want a type at all (Default)

{% endparameter %}

{% parameter 'required', 'Boolean or null', false %}

Can be either:

  • true - will show 'required' styled appropriately
  • false - will show 'optional' styled appropriately
  • null - won’t show anything (Default)

{% endparameter %}

{% parameter 'language', 'String', false %}

This is for when you want to show it conditionally, should match the tabbed snippet label, e.g. js. Defaults to null.

{% endparameter %}

{% parameter 'show', 'Boolean', false %}

This is for when you want to show it conditionally, and controls whether it should be visible by default. Defaults to true.

{% endparameter %}

Example

{% raw %}

{% parameter 'channel', 'PTPusherChannel', true, 'swift', false %}

The name of the channel to unsubscribe from.

{% endparameter %}

{% endraw %}

Contribute

Contributions welcome!

docs's People

Contributors

agatav avatar amad avatar amyrahmady avatar arpitpandey0209 avatar benjamin-tang-pusher avatar benw-pusher avatar ccaseypusher avatar damdo avatar danielrbrowne avatar deeborania avatar dependabot[bot] avatar fbenevides avatar gavinofla avatar georgerdbuckley avatar gileswells avatar hannaltc avatar hartmut-co-uk avatar jonheslop avatar marcelcorso avatar marcinwieczorek avatar maxthelion avatar meenaalfons avatar messagebtilly avatar michizhou avatar ovieokeh avatar singhashmeet avatar sonologico avatar warleyfranco avatar willpusher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docs's Issues

SDK integrationpage

Hello there, I spotted an issue on https://pusher.com/docs/beams/getting-started/ios/sdk-integration/

Why does the iOS SDK requires a "Background processing" background mode capability enabled? This mode requires permitted task identifiers to be specified in the info.plist file, what are the identifiers required?

Or is it just a typo and the "Background fetch" background mode capability is required instead?

Pusher Channels Error

Hello there, I spotted an issue on https://
image
pusher.com/docs/channels/using_channels/connection/

I'm using Pusher for my ionic project. The server can connects with my app at first but after certain times or after making many requests and this error will come out and disconnect the running of the server. How can I fix this?

uneven variable name for beamsTokenProvider

Hello there, I spotted an issue on https://pusher.com/docs/beams/guides/publish-to-specific-user/web/

In "Setting up a TokenProvider" section the token provider name is "tokenProvider". But below in "Associating the device with the user when they log in and enable notifications" section same variable is initialized as "beamsTokenProvider" and is used with the same name.

Someone who is copying and pasting code from this page faces "ReferenceError: beamsTokenProvider is not defined" error if combines code from those 2 different sections.

Authenticating userspage

Hello there, I have a question regarding the Authentication server API.
Imagine a user has an access to a pusher channel, which is later revoked from him.

Is there a way for the server to send a Deauth message that will disconnect the client's websocket with Pusher's servers?

Unexpected status code 401: Unauthorized, Could not parse JWT

Hello,

I am pretty sure I am on the wrong here but we never know. I think I spotted an issue on https://pusher.com/docs/beams/guides/publish-to-specific-user/web/.

My JS code (as on the doc)

const beamsClient = new PusherPushNotifications.Client({ instanceId: 'MY_KEY', }); const beamsTokenProvider = new PusherPushNotifications.TokenProvider({ url: "MY_API_URL" }); beamsClient .start() .then(() => beamsClient.setUserId("user_1", beamsTokenProvider)) .catch(console.error);

returns the following console errors :

push-notifications-cdn.js:889 PUT https://MY_KEY.pushnotifications.pusher.com/device_api/v1/instances/MY_KEY/devices/web/web-9e20dc2a-da22-46ea-89c4-abe51b989828/user 401 (Unauthorized)

And

Error: Unexpected status code 401: Unauthorized, Could not parse JWT at _callee2$ (push-notifications-cdn.js:968) at tryCatch (push-notifications-cdn.js:82) at Generator.invoke [as _invoke] (push-notifications-cdn.js:308) at Generator.prototype.<computed> [as next] (push-notifications-cdn.js:134) at asyncGeneratorStep (push-notifications-cdn.js:770) at _next (push-notifications-cdn.js:792)

Any clue ? Thank you very much. If you need additional info please let me know

Pusher Channels Docs | Page heading not apparent when coming to page via link to subheading

Hello there, I spotted an issue on https://pusher.com/docs/channels/using_channels/cache-channels/

This relates to all individual pages with a "Contents" navigation. I actually reached that page via a link to a subheading, and when I did I couldn't tell which topic page I was on. A way to address this would be to scroll the main navigation to the current page, or to replace "Contents" in the in-page navigation with the heading of the page.

Fix please

chrome-distiller://693fff3d-db6c-4c44-81bb-bddd51104b6e_b3bd077a0dbb027b060c45375791a02d83b1eeb3b71bceaadeb24aea9348933d/?title=https%3A%2F%2Fgameserver02.lucky897.com%2Frgs%2Fviews%2Flucky%2Fembed.html%3Fsid%3DS9fe649575d68%26home%3Dhttps%3A%2F%2Fm.bspin.io%2Fcategory%2Fbitcoin-all-games%2F%3FgoBack%3Dgame-5779&url=https%3A%2F%2Fgameserver02.lucky897.com%2Frgs%2Fviews%2Flucky%2Fembed.html%3Fsid%3DS9fe649575d68%26home%3Dhttps%3A%2F%2Fm.bspin.io%2Fcategory%2Fbitcoin-all-games%2F%3FgoBack%3Dgame-5779

Authenticated Users: Beams Token only available via SDK?

Hello there, you described how you can couple a DeviceID with an arbitrary unique UserId in the
https://pusher.com/docs/beams/concepts/authenticated-users/ section. To accomplish that, I need a Beams Token generated by an SDK.

The thing is I am writing the server as a Rust application, which has not an SDK yet.
Is there a way to fetch the Beams Token via a request? Or can you describe a way, what it should look like, if I want to create it myself together with the secret I have?

Pusher Channels Docs | How to build presence channelspage: max number of users wrong?

Hello there, I spotted an issue on https://pusher.com/docs/channels/using_channels/presence-channels/

We have just tested to go to more than a hundred in a presence channel, to see if it would crash our implementation or not, and turns out we can go above that limit?

What's the actual limit? What would happen when the N+1 user connects to that presence channel? would it raise an exception or just generate an pusher:subscription_errorevent on the channel?

Thanks

Broken link to a webhook doc

When I go to webhooks page under Home -> Channels -> my app, there is link in:

Webhooks

Webhooks allow your server to be notified about events occurring within your Channels app. Learn more in our Webhook documentation.

The link to Webhook documentation is broken.

Pusher Channels Docs | HTTP API Referencepage (Feature Request)

I don´t know if this is the right place for this. But:

Hello there, I want to suggest a feature to https://pusher.com/docs/channels/library_auth_reference/rest-api/

Add a query string param in order to send user_info and its contents in the object that returns (as of now) only the user id.

The query string param could be "with_user_info", and the API response will include the user_info attribute and its contents when with_user_info=1

Pusher Channels Docs | Sending events to authenticated userspage

Hello there, I spotted an issue on https://pusher.com/docs/channels/server_api/server-to-user-messages/

image

The method sendToUser does not seem to exist neither on the server side library (https://www.npmjs.com/package/pusher) nor on the client library (https://www.npmjs.com/package/pusher-js), which is actually a shame, would have been helpful for me to invoke a specific event to one particular user (and excluding all other participants via socketId seems rather counter-intuitive and cumbersome to implement. Either way, guess the docs need to be updated here? Please let me know in case I'm wrong with my observation.

Thanks

PS: Pusher rocks, this is the very first issue I've encountered so far (after weeks of working with it), so imo you have a really good service offered here (including documentation etc.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.