Created
October 31, 2015 10:47
-
-
Save RElesgoe/36c1f89aa9d294139270 to your computer and use it in GitHub Desktop.
PvPGN Connector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.app.runtime.onLaunched.addListener(function() { | |
chrome.app.window.create('window.html', { | |
'outerBounds': { | |
'width': 400, | |
'height': 500 | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "PvPGN Connector", | |
"description": "test", | |
"version": "1.0.0", | |
"app": { | |
"background": { | |
"scripts": ["connector.js"] | |
} | |
}, | |
"sockets": { | |
"udp": { | |
// Permission for chrome.sockets.udp.send: | |
// The application is allowed to send udp packets | |
// to any host:6112 combination. | |
"send": "*:6112" | |
}, | |
"tcp": { | |
// Permission for chrome.sockets.tcp.connect: | |
// The application is allowed to connect to | |
// any server port 6112. | |
"connect": "*:6112" | |
}, | |
"tcpServer": { | |
// Permission for chrome.sockets.tcpServer.listen: | |
// The application is allowed to accept new client | |
// connections on the local address at port 6112. | |
"listen": "127.0.0.1:6112" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.sockets.tcp.create({}, function(createInfo) | |
{ | |
chrome.sockets.tcp.connect(createInfo.socketId, "127.0.0.1", 6112, function(result) { | |
if (result < 0) | |
{ | |
console.log("Connection failed"); | |
} | |
}); | |
var buffer = new ArrayBuffer(1); | |
var init_protocol_bnet = new Int8Array(buffer); | |
init_protocol_bnet.set(0x01); | |
chrome.sockets.tcp.send(createInfo.socketId, init_protocol_bnet, function(sendInfo) { | |
if (sendInfo.resultCode < 0) | |
{ | |
console.log("Send init failed"); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<div>Hello, world!</div> | |
<script src="script.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment