GithubHelp home page GithubHelp logo

atakamallc / cordova-chrome-net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theveloped/cordova-chrome-net

0.0 4.0 0.0 180 KB

Use the Node `net` API cordova mobile applications using the chrome-socket plugins

License: MIT License

JavaScript 99.81% HTML 0.19%

cordova-chrome-net's Introduction

cordova-chrome-net

Use the Node net API in cordova Apps with the chrome-socket plugins

This module lets you use the Node.js net (TCP) API in cordova/ionic mobile apps using cordova-plugin-chrome-apps-sockets-tcp and cordova-plugin-chrome-apps-sockets-tcpserver plugins for cordova.

Instead of learning the quirks of Chrome's chrome.sockets API for networking in Chrome Apps just use the higher-level node API you're familiar with. Then, compile your code with browserify and you're all set!

This module is used by cordova-bitcore.

install

npm install cordova-chrome-net

methods

Use node's net API, including all parameter list shorthands and variations.

Example TCP client:

var net = require('cordova-chrome-net')

var client = net.createConnection({
  port: 1337,
  host: '127.0.0.1'
})

client.write('beep')

client.on('data', function (data) {
  console.log(data)
})

// .pipe() streaming API works too!

Example TCP server:

var net = require('cordova-chrome-net')

var server = net.createServer()

server.on('listening', function () {
  console.log('listening')
})

server.on('connection', function (sock) {
  console.log('Connection from ' + sock.remoteAddress + ':' + sock.remotePort)
  sock.on('data', function (data) {
    console.log(data)
  })
})

server.listen(1337)

See nodejs.org for full API documentation: net

license

MIT. Copyright (c) Tobias Scheepers, Feross Aboukhadijeh and John Hiesey.

cordova-chrome-net's People

Contributors

feross avatar janpot avatar jscissr avatar mrk-its avatar soldair avatar theveloped avatar throughnothing avatar

Watchers

 avatar  avatar  avatar  avatar

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.