Skip to content

How to handle connection timed out error #15

@kakopappa

Description

@kakopappa

Hi guys,

final events = EventSource(Uri.parse(sseEndpointUrl), initialReconnectDelay: new Duration(seconds:1));
 
try {
	events.events.listen((MessageEvent message) {
	  print('SSE event: ${message.data}');
	}).onError((error) => {
	  print('SSE event error: $error')
	});
} on SocketException catch(error) {
	print('$error');          
}

E/flutter (30879): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: SocketException: OS Error: Connection timed out, errno = 110, address = 192.168.1.100, port = 53342
E/flutter (30879):

This throws SocketException when the server is unavailable, it doesn't seem to goto onError or try catch. any idea how to handle it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions