Skip to content

Commit

Permalink
Merge pull request #85 from Tlantic/feat/send-express-api
Browse files Browse the repository at this point in the history
Feat/send express api
  • Loading branch information
diogoqueiros authored Nov 6, 2019
2 parents b277f8f + 12f1ba1 commit da9d61b
Show file tree
Hide file tree
Showing 7 changed files with 682 additions and 454 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ window.tlantic.plugins.socket.connect(
);
```

### send (successCallback, errorCallback, host, port, data)
### send (successCallback, errorCallback, connectionId, data)

Sends information and calls success callback if information was send and does not wait for any response. To check how to receive data, please see the item below.

Expand All @@ -94,12 +94,34 @@ window.tlantic.plugins.socket.send(
console.log('worked!');
},
function () {
console.log('failed!');
},
'192.168.2.5:18002',
'This is the data i want to send!'
);
```

### sendExpress (successCallback, errorCallback, host, port, data, charset, format)

Opens a socket connection, send data and closes connection.

Example:

```
window.tlantic.plugins.socket.sendExpress(
function () {
console.log('worked!');
},
function () {
console.log('failed!');
},
'192.168.2..5',
18002,
'This is the data i want to send!'
'This is the data i want to send!',
'Windows-1252', // optional
'base64' // optional
);
```

Expand Down
62 changes: 31 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"name":"cdv-socket-plugin",
"version":"0.4.1",
"description":"cdv-socket-plugin",
"cordova":{
"id":"com.tlantic.cdv-socket-plugin",
"platforms":[
"ios",
"android",
"wp8"
]
},
"repository":{
"type":"git",
"url":"git+https://github.com/Tlantic/cdv-socket-plugin.git"
},
"keywords":[
"ecosystem:cordova",
"cordova-ios",
"cordova-android",
"cordova-wp8"
],
"engines":{
"name":"cordova",
"version":">=3.0.0"
},
"author":"",
"license":"MIT",
"bugs":{
"url":"https://github.com/Tlantic/cdv-socket-plugin/issues"
},
"homepage":"https://github.com/Tlantic/cdv-socket-plugin#readme"
"name": "cdv-socket-plugin",
"version": "0.6.0",
"description": "cdv-socket-plugin",
"cordova": {
"id": "com.tlantic.cdv-socket-plugin",
"platforms": [
"ios",
"android",
"wp8"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/Tlantic/cdv-socket-plugin.git"
},
"keywords": [
"ecosystem:cordova",
"cordova-ios",
"cordova-android",
"cordova-wp8"
],
"engines": {
"name": "cordova",
"version": ">=3.0.0"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/Tlantic/cdv-socket-plugin/issues"
},
"homepage": "https://github.com/Tlantic/cdv-socket-plugin#readme"
}
39 changes: 20 additions & 19 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.tlantic.plugins.socket"
version="0.4.1">
<plugin xmlns:android="http://schemas.android.com/apk/res/android"
id="com.tlantic.plugins.socket" version="0.6.0"
xmlns="http://apache.org/cordova/ns/plugins/1.0">
<name>Socket</name>
<description>Tlantic TCP socket plugin</description>
<license>GPL</license>
<keywords>cordova, tcp, socket</keywords>

<js-module src="www/socket.js" name="Socket">
<js-module name="Socket" src="www/socket.js">
<clobbers target="window.tlantic.plugins.socket" />
</js-module>

<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<config-file parent="/*" target="res/xml/config.xml">
<feature name="Socket">
<param name="android-package" value="com.tlantic.plugins.socket.SocketPlugin"/>
<param name="android-package" value="com.tlantic.plugins.socket.SocketPlugin" />
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<config-file parent="/manifest" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.INTERNET" />
</config-file>
<source-file src="src/android/SocketPlugin.java" target-dir="src/com/tlantic/plugins/socket" />
<source-file src="src/android/Connection.java" target-dir="src/com/tlantic/plugins/socket" />
</config-file>
<source-file src="src/android/SocketPlugin.java"
target-dir="src/com/tlantic/plugins/socket" />
<source-file src="src/android/Connection.java"
target-dir="src/com/tlantic/plugins/socket" />
</platform>

<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<config-file parent="/*" target="config.xml">
<feature name="Socket">
<param name="ios-package" value="CDVSocketPlugin" />
</feature>
Expand All @@ -38,22 +39,22 @@
<header-file src="src/ios/Connection.h" />

<source-file src="src/ios/CDVSocketPlugin.m" />
<source-file src="src/ios/Connection.m" />
<source-file src="src/ios/Connection.m" />
</platform>

<!-- windows8 -->
<!-- windows8 -->
<platform name="windows8">
<js-module src="src/windows8/Connection.js" name="Connection">
<js-module name="Connection" src="src/windows8/Connection.js">
<merges target="" />
</js-module>
<js-module src="src/windows8/SocketProxy.js" name="SocketProxy">
</js-module>
<js-module name="SocketProxy" src="src/windows8/SocketProxy.js">
<merges target="" />
</js-module>
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
<config-file parent="/Package/Capabilities" target="package.appxmanifest">
<Capability Name="internetClientServer" />
<Capability Name="privateNetworkClientServer" />
<Capability Name="internetClient" />
</config-file>
</platform>
</platform>

</plugin>
Loading

0 comments on commit da9d61b

Please sign in to comment.