@BacRoom wrote:
Not able to establish socket connection in Android device using ionic-4
I am able to establish the connection via browser and ios devices but strangely not able to on android devices.
app.module.ts
const config: SocketIoConfig = { url: 'http://www.example.com:3434', options: {} }; @NgModule({ declarations: [AppComponent], entryComponents: [], imports: [ BrowserModule, IonicModule.forRoot(), AppRoutingModule, SocketIoModule.forRoot(config), IonicStorageModule.forRoot(), CommonModule, ComponentModule, ], providers: [ StatusBar, SplashScreen, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, Network ], bootstrap: [AppComponent] })
socket-connection.service.ts
import { Socket } from 'ngx-socket-io'; import { Observable } from 'rxjs/Observable'; export class SocketConnectionService { constructor(public socket : Socket) { } request(){ this.socket.emit('request',data) } }
Posts: 1
Participants: 1