npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@titanium/streams

v1.0.41

Published

⭐ Axway Amplify module for using Axway Amplify Streams with Appcelerator Titanium SDK Framework

Downloads

55

Readme

👉    A group of Axway employees, ex-Axway employees, and some developers from Titanium community have created a legal org and now officially decide all matters related to future of these products.

API FAQ:

 

Click to watch on Youtube

  ↑ Watch video on YouTube ↑

 

@titanium/streams

https://www.npmjs.com/package/@titanium/streams

Titanium Native mobile SDK for AMPLIFY Streams

📝 Description

AMPLIFY Streams is a real-time cache proxy allowing you to poll standard public REST APIs and push updates to clients. But wait, there is more! AMPLIFY Streams keeps an history of modifications that occur on the data between two polling! This way, AMPLIFY Streams is able to give you the list of modifications which happened since last time you fetched the data.

In other words, AMPLIFY Streams is the perfect cache to dramatically reduce the bandwidth consumption to transfer data that change both rarely and frequently.

AMPLIFY Streams Titanium SDK is based on Axway AMPLIFY Streams JavaScript SDK

✨ Features

  • [x] Incremental data update: replacing polling by push is not enough to minimize data streams. That's why streamdata.io pushes only the part that has changed.
  • [x] Server-Sent-Events (SSE): updates are pushed to the client using SSE protocol. By providing fallback mechanisms streamdata.io can also work with older browsers.
  • [x] API Cache: to reduce server load and latency, streamdata.io has an integrated cache mechanism.

🚀 Getting Started

Installing

Please ensure there is a package.json file in the target directory. If there is not one present, you can create one with npm init.

If you wish to install this in an app using Titanium Turbo, you can execute this in the project root directory:

npm install @titanium/streams

If you wish to install this in an app using Titanium Alloy, you can execute the following in the project root directory:


cd app
npm install @titanium/streams

Connect to your API

Create a StreamDataEventSource object into your JavaScript code.

    var myEventSource = streamdataio.createEventSource("http://mysite.com/myRestService", <app_token>);

The StreamDataEventSource is the entry point for establishing a data stream connection to the given URL.

It uses an application token to identify and authorize the stream connection to be established.

To get a valid token, please visit streamdata.io web site to register and create an application.

It uses standard HTTP Server-Sent Events to get the data you required through streamdata.io proxy.

If your API requires specific headers, simply pass them as an array on the event source creation, and streamdata.io will forward them to your Information System.

An optional headers parameter can be passed to the createEventSource method.

It must be an array with the following structure:

['header1: headervalue1', 'header2: headervalue2']

Here is an example to add a Basic authorization header to your target API call:


    // Your api URL
    var url = 'http://mysite.com/myJsonRestService';

    // add whatever header required by your API
    var headers = ['Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='];

    var myEventSource = streamdataio.createEventSource(url,<app_token>, headers);
	

Handle received data

Axway Streams SDK handles data from the targeted REST service as JSON objects.

When the StreamDataEventSource object is opened, the initial set of data is returned as it would be with a standard call to the service URL. This data set is called the snapshot. The SDK returns it through the onData callback.

The updates of this initial set will come subsequently in the JSON-Patch format through the onPatch callback. Such a data update is called a patch.

You can define your callback functions as follows:

    myEventSource.onData(function(data){
        // initialize your data with the initial snapshot
    }).onPatch(function(patch){
        // update the data with the provided patch
    }).onError(function(error){
        // do whatever you need in case of error
    }).onOpen(function(){
        // you can also add custom behavior when the stream is opened
    });

Start receiving data

    myEventSource.open();

🔗 Related Links

  • Titanium Mobile - Open-source tool for building powerful, cross-platform native apps with JavaScript.
  • Titanium Alloy - MVC framework built on top of Titanium Mobile.
  • Appcelerator - Installer for the Appcelerator Platform tool
  • Titanium Turbo - Variation of Titanium Alloy that adds some enhancements and customizations for rapid development.
  • Geek Mobile Toolkit - Toolkit for creating, building, and managing mobile app projects.

📚 Learn More

📣 Feedback

Have an idea or a comment? Join in the conversation here!

©️ Legal

Alloy is developed by Appcelerator and the community and is Copyright © 2012-Present by Appcelerator, Inc. All Rights Reserved.

Alloy is made available under the Apache Public License, version 2. See their license file for more information.

Appcelerator is a registered trademark of Appcelerator, Inc. Titanium is a registered trademark of Appcelerator, Inc. Please see the LEGAL information about using trademarks, privacy policy, terms of usage and other legal information at http://www.appcelerator.com/legal.