Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ The second one is a singleton to register different Ext.ux.WebSocket and it prov

## ExtJS 5
The new version of ExtJS 5 has requested to make a new major version of `ExtJS-WebSocket`.
Now, this new major version **v1.0.0** is located on the master branch.
Now, this new major version **v1.0.1** is located on the master branch.

## ExtJS 4 & Sencha Touch 2
It's possible to work either with ExtJS 4 and Sencha Touch 2 with previous version **v0.0.5**
It's possible to work either with ExtJS 4 and Sencha Touch 2 with previous version **v0.0.6**

## Install via Bower
First of all, install [**Bower**](http://bower.io/).
Expand All @@ -22,10 +22,10 @@ Then install `Ext.ux.WebSocket` (version v1.x.x for ExtJS 5):
$ bower install ext.ux.websocket
```

Or install `Ext.ux.WebSocket` (version v0.0.5 for ExtJS 4 & Sencha Touch 2):
Or install `Ext.ux.WebSocket` (version v0.0.6 for ExtJS 4 & Sencha Touch 2):

```bash
$ bower install ext.ux.websocket#0.0.5
$ bower install ext.ux.websocket#0.0.6
```

Now, you got the extension at the following path: *YOUR_PROJECT_PATH/bower_components/ext.ux.websocket/*
Expand Down Expand Up @@ -285,7 +285,7 @@ It will make the documentation into docs dir and it will be visible at: http://l
## License
The MIT License (MIT)

Copyright (c) 2013 Vincenzo Ferrari <wilk3ert@gmail.com>
Copyright (c) 2015 Vincenzo Ferrari <wilk3ert@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 2 additions & 0 deletions WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ Ext.define('Ext.ux.WebSocket', {
constructor: function (cfg) {
var me = this;

me.messageQueue = (cfg.messageQueue || []).slice();

// Raises an error if no url is given
if (Ext.isEmpty(cfg)) {
Ext.Error.raise('URL for the websocket is required!');
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Ext.ux.WebSocket",
"version": "v1.0.0",
"version": "v1.0.1",
"homepage": "https://github.com/wilk/ExtJS-WebSocket",
"authors": [
"Vincenzo (Wilk) Ferrari <wilk3ert@gmail.com>"
Expand Down
16 changes: 11 additions & 5 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ Ext.define ('DEMO.view.OpenConnection', {
url: url ,
listeners: {
open: function (ws) {
if (Ext.get(ws.url)) Ext.get(ws.url).dom.innerHTML += '> WebSocket just open!<br/>';
var container = Ext.ComponentQuery.query('panel[title="' + url + '"] > container#messageCt')[0];
var messageBox = container.getEl().dom.getElementsByClassName("messageBox")[0];
messageBox.innerHTML += '> WebSocket just open!<br/>';
} ,
message: function (ws, data) {
Ext.get(ws.url).dom.innerHTML += '> ' + data + '<br/>';
var container = Ext.ComponentQuery.query('panel[title="' + url + '"] > container#messageCt')[0];
var messageBox = container.getEl().dom.getElementsByClassName("messageBox")[0];
messageBox.innerHTML += '> ' + data + '<br/>';
messageBox.scrollTop = messageBox.scrollHeight;
} ,
close: function (ws) {
var panel = Ext.getCmp ('panel' + ws.url);
var panel = Ext.ComponentQuery.query('panel[title="' + url + '"]')[0];

if ((panel != null) || (panel != undefined)) {
panel.destroy ();
Expand All @@ -41,7 +46,6 @@ Ext.define ('DEMO.view.OpenConnection', {
var panel = Ext.create ('Ext.panel.Panel', {
title: url ,
ws: ws ,
id: 'panel' + url ,

layout: 'anchor' ,

Expand All @@ -50,7 +54,8 @@ Ext.define ('DEMO.view.OpenConnection', {

items: [{
xtype: 'container' ,
html: 'Incoming from the server:<br/><div id="' + url + '" style="height: 60px; border: black solid 1px; padding: 5px; margin: 5px 0 5px 0; overflow: auto"></div>'
html: 'Incoming from the server:<br/><div class="messageBox" style="height: 60px; border: black solid 1px; padding: 5px; margin: 5px 0 5px 0; overflow: auto"></div>' ,
itemId: 'messageCt'
} , {
xtype: 'textarea' ,
labelAlign: 'top' ,
Expand Down Expand Up @@ -106,6 +111,7 @@ Ext.define ('DEMO.view.OpenConnection', {
xtype: 'textfield' ,
anchor: '100%' ,
fieldLabel: 'URL' ,
value: 'ws://localhost:9001' ,
labelAlign: 'top' ,
listeners: {
specialKey: function (tf, evt) {
Expand Down
5 changes: 3 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>ExtJS WebSocket</title>
<link rel="stylesheet" type="text/css" href="http://cdn.sencha.com/ext-4.2.0-gpl/resources/css/ext-all.css"/>
<script src="http://cdn.sencha.com/ext-4.2.0-gpl/ext-all.js"> </script>
<script src="http://cdn.sencha.com/ext/gpl/5.1.0/build/ext-all.js"></script>
<link rel="stylesheet" type="text/css" href="http://cdn.sencha.com/ext/gpl/5.1.0/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css"/>
<script src="http://cdn.sencha.com/ext/gpl/5.1.0/packages/ext-theme-crisp/build/ext-theme-crisp.js"></script>
<script src="demo.js"> </script>
</head>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Ext.ux.WebSocket",
"version": "0.0.0",
"version": "1.0.1",
"description": "Ext.ux.WebSocket is an extension to manage HTML5 WebSocket with ExtJS and SenchaTouch",
"main": "WebSocket.js",
"scripts": {
Expand Down