All Projects → floatinghotpot → Cordova Httpd

floatinghotpot / Cordova Httpd

Embed tiny web server into Cordova with a plugin

Projects that are alternatives of or similar to Cordova Httpd

Unityionicintegration
A guide to integrating Unity 3D content into an Ionic app and sending messages between them (for Android & iOS)(tested with Vuforia plugin)
Stars: ✭ 94 (-65.31%)
Mutual labels:  plugin, cordova
Cordova Plugin Admob
Basic Cordova Plugin for AdMob
Stars: ✭ 263 (-2.95%)
Mutual labels:  plugin, cordova
Framework7 Plugin 3d Panels
Framework7 plugin to add 3d effect for side panels
Stars: ✭ 56 (-79.34%)
Mutual labels:  plugin, cordova
Cordova Plugin Document Viewer
A Document Viewer cordova/phonegap plugin for iOS, Android and Windows
Stars: ✭ 168 (-38.01%)
Mutual labels:  plugin, cordova
Admob Plus
Trustable AdMob Plugin for Cordova, Capacitor, Ionic
Stars: ✭ 195 (-28.04%)
Mutual labels:  plugin, cordova
Cordovacn
Apache Cordova is an open-source mobile development framework. It allows you to use standard web technologies such as HTML5, CSS3, and JavaScript for cross-platform development, avoiding each mobile platforms' native development language. (Apache Cordova是一个开放源代码的移动开发框架,它允许你使用web技术如:JavaScript,HTML,CSS进行跨平台开发,避免使用原生开发。)
Stars: ✭ 240 (-11.44%)
Mutual labels:  plugin, cordova
Cordova Plugin Nativeaudio
The low latency audio plugin is designed to enable low latency and polyphonic audio from Cordova/PhoneGap applications, using a very simple and basic API.
Stars: ✭ 220 (-18.82%)
Mutual labels:  plugin, cordova
cordova-plugin-webserver
A webserver plugin for cordova
Stars: ✭ 101 (-62.73%)
Mutual labels:  cordova, webserver
Excel2unity
一个为Unity3D编写的插件,可以快速地将Excel文件转换为JSON、CSV和XML
Stars: ✭ 255 (-5.9%)
Mutual labels:  plugin
Odi
🌪🌌 Opinionated, Declarative, Idiomatic framework for building scalable, supportable and reliable enterprise applications.
Stars: ✭ 264 (-2.58%)
Mutual labels:  webserver
Damnwebscanner
Another web vulnerabilities scanner, this extension works on Chrome and Opera
Stars: ✭ 254 (-6.27%)
Mutual labels:  plugin
Motrix Webextension
A chrome extension for the Motrix Download Manager
Stars: ✭ 253 (-6.64%)
Mutual labels:  plugin
Server Configs Apache
Apache HTTP server boilerplate configs
Stars: ✭ 2,916 (+976.01%)
Mutual labels:  httpd
Juce
JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, RTAS and AAX audio plug-ins.
Stars: ✭ 3,841 (+1317.34%)
Mutual labels:  plugin
Awesome Cordova
📱 A curated list of amazingly awesome Cordova libraries, resources and shiny things.
Stars: ✭ 269 (-0.74%)
Mutual labels:  cordova
Cathook
Training Software for the game Team Fortress 2
Stars: ✭ 256 (-5.54%)
Mutual labels:  plugin
Cordova Plugin Dialogs
Apache Cordova Plugin dialogs
Stars: ✭ 267 (-1.48%)
Mutual labels:  cordova
Vim Crystalline
Functions for taking the monotony out of building your own fancy statusline in Vim
Stars: ✭ 264 (-2.58%)
Mutual labels:  plugin
expross
Expross is a lightweight webserver to introduce JavaScript developers familiar with Express to Python.
Stars: ✭ 27 (-90.04%)
Mutual labels:  webserver
Android Mvp Mvvm Flytour
🔥🔥🔥 FlyTour是Android MVVM+MVP+Dagger2+Retrofit+RxJava+组件化+插件组成的双编码架构+双工程架构+双语言Android应用开发框架,通过不断的升级迭代该框架已经有了十个不同的版本,5.0之前工程架构采用gradle配置实现组件化,5.0之后的工程架构采用VirtualAPK实现了插件化,5.0之前采用Java编码实现,5.0之后采用Kotlin编码实现,编码架构由MVVM和MVP组成,工程架构和编码架构及编码语言开发者可根据自己具体的项目实际需求去决定选择使用,该框架是Android组件化、Android插件化、Android MVP架构、Android MVVM架构的集大成者,帮助你快速的搭建自己的App项目开发框架,以便把主要的精…
Stars: ✭ 2,948 (+987.82%)
Mutual labels:  plugin

CorHttpd: embeded httpd for cordova

Supported platform:

  • iOS
  • Android

You can browse (locally or remotely) to access files in android/ios phone/pad:

  • browse the files in mobile device with a browser in PC.
  • copy files from mobile device to PC quickly, just with Wifi.
  • use cordova webview to access the assets/www/ content with http protocol.

Why http access is good?

  • Use wifi instead of cable, more convenient.
  • For security reason, browser does not support local AJAX calls. It's big bottle neck to deploy HTML5 games to Cordova platform.
  • The most popular phaser.js game engine, a httpd is always required, as it use AJAX to load resource.

How to use CorHttpd?

Add the plugin to your cordova project:

cordova plugin add https://github.com/floatinghotpot/cordova-httpd.git

Quick start, copy the demo files, and just build to play.

cp -r plugins/com.rjfun.cordova.httpd/test/* www/

Javascript APIs

startServer( options, success_callback, error_callback );

stopServer( success_callback, error_callback );

getURL( success_callback, error_callback );

getLocalPath( success_callback, error_callback );

Example code: (read the comments)

    var httpd = null;
    function onDeviceReady() {
        httpd = ( cordova && cordova.plugins && cordova.plugins.CorHttpd ) ? cordova.plugins.CorHttpd : null;
    }
    function updateStatus() {
    	document.getElementById('location').innerHTML = "document.location.href: " + document.location.href;
    	if( httpd ) {
    	  /* use this function to get status of httpd
    	  * if server is up, it will return http://<server's ip>:port/
    	  * if server is down, it will return empty string ""
    	  */
    		httpd.getURL(function(url){
    			if(url.length > 0) {
    				document.getElementById('url').innerHTML = "server is up: <a href='" + url + "' target='_blank'>" + url + "</a>";
    			} else {
    				document.getElementById('url').innerHTML = "server is down.";
    			}
    		});
    		// call this function to retrieve the local path of the www root dir
    		httpd.getLocalPath(function(path){
    			document.getElementById('localpath').innerHTML = "<br/>localPath: " + path;
        	});
    	} else {
    		alert('CorHttpd plugin not available/ready.');
    	}
    }
    function startServer( wwwroot ) {
    	if ( httpd ) {
    	    // before start, check whether its up or not
    	    httpd.getURL(function(url){
    	    	if(url.length > 0) {
    	    		document.getElementById('url').innerHTML = "server is up: <a href='" + url + "' target='_blank'>" + url + "</a>";
	    	    } else {
	    	        /* wwwroot is the root dir of web server, it can be absolute or relative path
	    	        * if a relative path is given, it will be relative to cordova assets/www/ in APK.
	    	        * "", by default, it will point to cordova assets/www/, it's good to use 'htdocs' for 'www/htdocs'
	    	        * if a absolute path is given, it will access file system.
	    	        * "/", set the root dir as the www root, it maybe a security issue, but very powerful to browse all dir
	    	        */
    	    	    httpd.startServer({
    	    	    	'www_root' : wwwroot,
    	    	    	'port' : 8080,
    	    	    	'localhost_only' : false
    	    	    }, function( url ){
    	    	      // if server is up, it will return the url of http://<server ip>:port/
    	    	      // the ip is the active network connection
    	    	      // if no wifi or no cell, "127.0.0.1" will be returned.
        	    		document.getElementById('url').innerHTML = "server is started: <a href='" + url + "' target='_blank'>" + url + "</a>";
    	    	    }, function( error ){
    	    	    	document.getElementById('url').innerHTML = 'failed to start server: ' + error;
    	    	    });
    	    	}
    	    	
    	    });
    	} else {
    		alert('CorHttpd plugin not available/ready.');
    	}
    }
    function stopServer() {
    	if ( httpd ) {
    	    // call this API to stop web server
    	    httpd.stopServer(function(){
    	    	document.getElementById('url').innerHTML = 'server is stopped.';
    	    },function( error ){
    	    	document.getElementById('url').innerHTML = 'failed to stop server' + error;
    	    });
    	} else {
    		alert('CorHttpd plugin not available/ready.');
    	}
    }

Credits

This Cordova plugin is built based on following 2 projects, and thanks to the authors.

  • NanoHTTPD, written in java, for java / android, by psh.
  • CocoaHTTPServer, written in Obj-C, for iOS / Mac OS X, by robbiehanson.

You can use this plugin for FREE. Feel free to fork, improve and send pull request.

If need prompt support, please buy a license, you will be supported with high priority.

More Cordova/PhoneGap plugins by Raymond Xie, find them in plugin registry.

Project outsourcing and consulting service is also available. Please contact us if you have the business needs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].