I am new to react-native and working on a project in react-native. I integrated socket using following code.
this.socket = socketIO.connect(global.socketUrl, {
jsonp: false,
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax: 5000,
reconnectionAttempts: Infinity
});
Further I created instance of SocketManager class in my component using below code.
Obj= new SocketManger()
This code is working fine in debug build, but we are getting the following error
TypeError: Cannot read property 'initialize' of undefined\n at new Socket
TIA
We also followed answer mention at Here but not getting any accurate result. with this code we are getting below error.
After doing a lot of research i found my mistake. global variables doesn't work in IOS (Release Build). The issue was because of this global variable.
So i changed my code to
this.socket = socketIO.connect('url', {
jsonp: false,
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax: 5000,
reconnectionAttempts: Infinity
});
Now its working perfectly both in Android as well as IOS
Related
I'm using appium-dotnet-driver v4.0.0.4 beta of the appium nuget package (but I have downgraded to the previous versions too and I'm getting the same issue)
So I've never used it before, therefore not entirely sure how it should work. Currently I'm doing this:
private static AppiumDriver<AppiumWebElement> mobileDriver;
AppiumOptions opt = new AppiumOptions();
opt.AddAdditionalCapability("autoWebview", true);
switch (platform.ToLower())
{
case "ios":
{
foreach (var cap in MobileSettingsFileConstants.iosCapabilities)
{
opt.AddAdditionalCapability(cap.Key, cap.Value);
}
mobileDriver = new IOSDriver<AppiumWebElement>(GridUri, opt);
break;
}
When ever it tries to add an additional capability to Appium Options I get an exception : Exception thrown: 'System.MissingMethodException' in appium-dotnet-driver.dll, Additional information: Method not found: 'Void OpenQA.Selenium.Remote.DesiredCapabilities.set_Item
I've had a look on the appium forum and they said this was an issue. Can someone share their experience with this please?
I found out I had to be at the latest version on Selenium on both test framework and test solution.
Simple answer to a mind boggling question.
I'm getting the error ('this.fs.stat is not a function') on line 2256 of lokijs.js. Environment is Electron with Angular 5.x and LokiJS v1.5.3.
fs is set up on line 2244 of lokijs.js (this.fs = require('fs');) but when I examine this.fs in the browser tools immediately after that line executes, it is just an empty object.
I've been beating my head against LokiJS all afternoon and have managed to get this far, but have no idea where to go from here. fs has been in node since forever, so I don't think it's an issue with a node version.
I'm aware of the issues with require and webpack, but since this is happening in LokiJS, I'm not sure whether this is related and if so what the proper fix would be.
Any ideas/suggestions?
Thanks.
Update #1
Code:
import * as Loki from 'lokijs';
import { LokiFsAdapter } from 'lokijs';
this.adapter = new LokiFsAdapter();
this.db = new Loki('my.db', {
env: 'NODEJS',
autoload: true,
autosave: true,
verbose: true,
autoloadCallback: this.initCollections
});
This gets me the error I mentioned above. If I switch the first line to import { Loki } from 'lokijs'; I get this error instead: Uncaught (in promise): TypeError: lokijs_1.Loki is not a constructor
ExtJS version 6.2
I'm not allowed to call initConfig() from my extended textfield, in a contructor. The error it thrown is that,
initConfig should not be called by subclasses, it will be called by Ext.Component(…).
For some reason I can't use callParent() there.
It was available in ExtJS 5.0. Any alternatives for this?
Use Ext.apply(this, cfg) instead of initConfig(). It will solve your issue.
Sample old code:
constructor: function(cfg){
this.initConfig(cfg);
},
Sample correct code:
constructor: function(cfg){
//this.initConfig(cfg);
Ext.apply(this, cfg);
},
I have the following simplified code:
main.js:
var data = require("sdk/self").data;
var tabs = require("sdk/tabs");
tabs.on('ready', function(tab) {
console.log("start");
let worker = tab.attach({
contentScriptFile: [
data.url("jquery.min.js"),
data.url("test.js")
],
});
worker.port.emit("start", data.load("popups/start.html"));
console.log("end");
});
test.js:
console.log("test.js");
self.port.on("start", function (content) {
console.log("I get the message");
$('body').append(content);
});
The problem:
This works just fine and everything is ok in most cases. In only one web site and specifically in well known github.com, it produces the following error:
console.log: test: start
console.log: test: end
console.error:
Message: Error: call to Function() blocked by CSP
console.error:
Message: TypeError: this.sandbox is undefined
Stack:
receive#resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/content/worker-child.js:75:7
emitOnObject#resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:112:9
emit#resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:89:38
processMessageReceived#resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/remote/child.js:54:38
Note 1: The problem is with the exchange of the message start. But why it is working everywhere else except the github.com/*?
Note 2: I'm using cfx, with jpm it works fine. Is any way to fix that or I have to update my extension to run with jpm?
cfx is probably including an old version of the SDK while jpm runs with the browser's built-in version. Try running with --strip-sdk.
That said, cfx is deprecated, you should use jpm.
Github uses CSP directives to block unsafe script execution including eval and new Function(), many other sites don't.
Newer SDK versions initialize the addon script sandbox differently so it is not affected by CSPs.
I have installed monodroid and I am trying to build monodroid sample GLCube with VS 2010. I get a compile error for the following line in the CreateFrameBuffer function on the source. I am using latest Android SDK and Mono SDK (trial), and I am building for Android 2.2. Are these samples only meant for certain versions of Android Open GL? I just used the default platform of the sample solution/project file. Why won't the sample compile?
Line: GraphicsMode = new GraphicsMode (16, 0, 0, 0, 0, 0, false);
Error: 'OpenTK.Graphics.GraphicsMode' is a 'type' but is used like a 'variable'
E:\Dev\xamarin-monodroid-samples-4d92f45\GLCube\PaintingView.cs
Apparently you have checked out the sample code from github after a comitter broke it.
I suggest getting an earlier commit, say, this one.
Not sure about this, since I have not actually looked at the code in question, but from the snippet you posted, and the error you are getting, it looks like you need to declare a variable to assign the GraphicsMode object to.
Ex:
GraphicsMode gmMode = new GraphicsMode(16,0,0,0,0,0,false);