Socket
Socket
Sign inDemoInstall

@firebase/webchannel-wrapper

Package Overview
Dependencies
0
Maintainers
4
Versions
2955
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @firebase/webchannel-wrapper

A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application


Version published
Weekly downloads
1.6M
increased by4.31%
Maintainers
4
Created
Weekly downloads
 

Package description

What is @firebase/webchannel-wrapper?

The @firebase/webchannel-wrapper package is a part of the Firebase platform, specifically designed to provide a robust networking layer by wrapping the Google Closure Library's implementation of WebChannel. WebChannels facilitate bi-directional communication between client and server over the web. This package is particularly used within Firebase to support real-time data synchronization and other network interactions in web applications.

What are @firebase/webchannel-wrapper's main functionalities?

Real-time Data Synchronization

This feature allows for real-time data synchronization between the client and server. The code sample demonstrates how to set up a WebChannel, listen for messages from the server, and send a data request to the server.

import { WebChannel } from '@firebase/webchannel-wrapper';

const channel = new WebChannel('https://example.com/data', {json: true});
channel.listen('onmessage', (message) => {
  console.log('Data received:', message);
});
channel.send({ request: 'fetchData' });

Network Error Handling

This feature provides robust error handling mechanisms for network communications. The code sample shows how to listen for and handle network errors using the WebChannel.

import { WebChannel } from '@firebase/webchannel-wrapper';

const channel = new WebChannel('https://example.com/data');
channel.listen('onerror', (error) => {
  console.error('Network error occurred:', error);
});

Other packages similar to @firebase/webchannel-wrapper

Readme

Source

@firebase/webchannel-wrapper

NOTE: This is specifically tailored for Firebase JS SDK usage, if you are not a member of the Firebase team, please avoid using this package

This is a wrapper of some Webchannel Features for the Firebase JS SDK.

Usage

The following 5 modules are exposed for use:

  • createWebChannelTransport
  • ErrorCode
  • EventType
  • WebChannel
  • XhrIoPool

You can include these by doing the following:

ES Modules

import { WebChannel } from '@firebase/webchannel-wrapper'

// Do stuff with WebChannel

CommonJS Modules

const webchannelWrapper = require('@firebase/webchannel-wrapper');

// Do stuff with webchannelWrapper.ErrorCode, webchannelWrapper.EventType, etc 

FAQs

Last updated on 28 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc