Skip to content

Commit da9d61b

Browse files
authored
Merge pull request #85 from Tlantic/feat/send-express-api
Feat/send express api
2 parents b277f8f + 12f1ba1 commit da9d61b

7 files changed

Lines changed: 682 additions & 454 deletions

File tree

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ window.tlantic.plugins.socket.connect(
8282
);
8383
```
8484

85-
### send (successCallback, errorCallback, host, port, data)
85+
### send (successCallback, errorCallback, connectionId, data)
8686

8787
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.
8888

@@ -94,12 +94,34 @@ window.tlantic.plugins.socket.send(
9494
console.log('worked!');
9595
},
9696
97+
function () {
98+
console.log('failed!');
99+
},
100+
'192.168.2.5:18002',
101+
'This is the data i want to send!'
102+
);
103+
```
104+
105+
### sendExpress (successCallback, errorCallback, host, port, data, charset, format)
106+
107+
Opens a socket connection, send data and closes connection.
108+
109+
Example:
110+
111+
```
112+
window.tlantic.plugins.socket.sendExpress(
113+
function () {
114+
console.log('worked!');
115+
},
116+
97117
function () {
98118
console.log('failed!');
99119
},
100120
'192.168.2..5',
101121
18002,
102-
'This is the data i want to send!'
122+
'This is the data i want to send!',
123+
'Windows-1252', // optional
124+
'base64' // optional
103125
);
104126
```
105127

package.json

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
{
2-
"name":"cdv-socket-plugin",
3-
"version":"0.4.1",
4-
"description":"cdv-socket-plugin",
5-
"cordova":{
6-
"id":"com.tlantic.cdv-socket-plugin",
7-
"platforms":[
8-
"ios",
9-
"android",
10-
"wp8"
11-
]
12-
},
13-
"repository":{
14-
"type":"git",
15-
"url":"git+https://github.com/Tlantic/cdv-socket-plugin.git"
16-
},
17-
"keywords":[
18-
"ecosystem:cordova",
19-
"cordova-ios",
20-
"cordova-android",
21-
"cordova-wp8"
22-
],
23-
"engines":{
24-
"name":"cordova",
25-
"version":">=3.0.0"
26-
},
27-
"author":"",
28-
"license":"MIT",
29-
"bugs":{
30-
"url":"https://github.com/Tlantic/cdv-socket-plugin/issues"
31-
},
32-
"homepage":"https://github.com/Tlantic/cdv-socket-plugin#readme"
2+
"name": "cdv-socket-plugin",
3+
"version": "0.6.0",
4+
"description": "cdv-socket-plugin",
5+
"cordova": {
6+
"id": "com.tlantic.cdv-socket-plugin",
7+
"platforms": [
8+
"ios",
9+
"android",
10+
"wp8"
11+
]
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/Tlantic/cdv-socket-plugin.git"
16+
},
17+
"keywords": [
18+
"ecosystem:cordova",
19+
"cordova-ios",
20+
"cordova-android",
21+
"cordova-wp8"
22+
],
23+
"engines": {
24+
"name": "cordova",
25+
"version": ">=3.0.0"
26+
},
27+
"author": "",
28+
"license": "MIT",
29+
"bugs": {
30+
"url": "https://github.com/Tlantic/cdv-socket-plugin/issues"
31+
},
32+
"homepage": "https://github.com/Tlantic/cdv-socket-plugin#readme"
3333
}

plugin.xml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3-
xmlns:android="http://schemas.android.com/apk/res/android"
4-
id="com.tlantic.plugins.socket"
5-
version="0.4.1">
2+
<plugin xmlns:android="http://schemas.android.com/apk/res/android"
3+
id="com.tlantic.plugins.socket" version="0.6.0"
4+
xmlns="http://apache.org/cordova/ns/plugins/1.0">
65
<name>Socket</name>
76
<description>Tlantic TCP socket plugin</description>
87
<license>GPL</license>
98
<keywords>cordova, tcp, socket</keywords>
109

11-
<js-module src="www/socket.js" name="Socket">
10+
<js-module name="Socket" src="www/socket.js">
1211
<clobbers target="window.tlantic.plugins.socket" />
1312
</js-module>
1413

1514
<!-- android -->
1615
<platform name="android">
17-
<config-file target="res/xml/config.xml" parent="/*">
16+
<config-file parent="/*" target="res/xml/config.xml">
1817
<feature name="Socket">
19-
<param name="android-package" value="com.tlantic.plugins.socket.SocketPlugin"/>
18+
<param name="android-package" value="com.tlantic.plugins.socket.SocketPlugin" />
2019
</feature>
2120
</config-file>
22-
<config-file target="AndroidManifest.xml" parent="/manifest">
21+
<config-file parent="/manifest" target="AndroidManifest.xml">
2322
<uses-permission android:name="android.permission.INTERNET" />
24-
</config-file>
25-
<source-file src="src/android/SocketPlugin.java" target-dir="src/com/tlantic/plugins/socket" />
26-
<source-file src="src/android/Connection.java" target-dir="src/com/tlantic/plugins/socket" />
23+
</config-file>
24+
<source-file src="src/android/SocketPlugin.java"
25+
target-dir="src/com/tlantic/plugins/socket" />
26+
<source-file src="src/android/Connection.java"
27+
target-dir="src/com/tlantic/plugins/socket" />
2728
</platform>
2829

2930
<!-- ios -->
3031
<platform name="ios">
31-
<config-file target="config.xml" parent="/*">
32+
<config-file parent="/*" target="config.xml">
3233
<feature name="Socket">
3334
<param name="ios-package" value="CDVSocketPlugin" />
3435
</feature>
@@ -38,22 +39,22 @@
3839
<header-file src="src/ios/Connection.h" />
3940

4041
<source-file src="src/ios/CDVSocketPlugin.m" />
41-
<source-file src="src/ios/Connection.m" />
42+
<source-file src="src/ios/Connection.m" />
4243
</platform>
4344

44-
<!-- windows8 -->
45+
<!-- windows8 -->
4546
<platform name="windows8">
46-
<js-module src="src/windows8/Connection.js" name="Connection">
47+
<js-module name="Connection" src="src/windows8/Connection.js">
4748
<merges target="" />
48-
</js-module>
49-
<js-module src="src/windows8/SocketProxy.js" name="SocketProxy">
49+
</js-module>
50+
<js-module name="SocketProxy" src="src/windows8/SocketProxy.js">
5051
<merges target="" />
5152
</js-module>
52-
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
53+
<config-file parent="/Package/Capabilities" target="package.appxmanifest">
5354
<Capability Name="internetClientServer" />
5455
<Capability Name="privateNetworkClientServer" />
5556
<Capability Name="internetClient" />
5657
</config-file>
57-
</platform>
58+
</platform>
5859

5960
</plugin>

0 commit comments

Comments
 (0)